[Skiboot] [PATCH 5/8] pci_configure_mps(): Check empty pointer before dereferencing

Kamalesh Babulal kamalesh at linux.vnet.ibm.com
Wed Jun 24 15:04:40 AEST 2015



On 06/24/2015 05:24 AM, Samuel Mendoza-Jonas wrote:
> On 23/06/15 18:37, Kamalesh Babulal wrote:
>> Re-arrange the code in pci_configure_mps() to avoid dereferencing
>> of in-valid pointer.
>>
>> Fixes Coverity defect#97851.
>>
>> Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
>> ---
>>  core/pci.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/core/pci.c b/core/pci.c
>> index 8f8aeeb..fe23d6c 100644
>> --- a/core/pci.c
>> +++ b/core/pci.c
>> @@ -611,14 +611,15 @@ static int pci_configure_mps(struct phb *phb,
>>  	uint32_t ecap, mps = phb->mps;
> You should also avoid initialising mps here in case phb is NULL,
> especially since you're assigning it down...
>

Thanks for the review. ah !! the intention was to remove the
initialising. :(
>>  	uint16_t val;
>>  
>> +	if (!phb || !pd)
>> +		return 0;
>> +
>> +	mps = phb->mps;

-- 
Cheers,
Kamalesh.



More information about the Skiboot mailing list