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

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



On 06/24/2015 05:26 AM, Gavin Shan wrote:
> On Tue, Jun 23, 2015 at 02:07:35PM +0530, 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;
>> 	uint16_t val;
>>
>> +	if (!phb || !pd)
>> +		return 0;
>> +
> I think the check can be dropped. I don't see this function is called
> with NULL phb/pd.

Thanks for the review. I will redo the patch by just dropping the check.

-- 
Cheers,
Kamalesh.



More information about the Skiboot mailing list