RE: smatch: leds: potential null deref

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Excuse me on late response. Now I fix it.

Richard,
Could you help to review & merge this patch?

Thanks
Haojian

-----Original Message-----
From: Dan Carpenter [mailto:error27@xxxxxxxxx] 
Sent: 2010年4月7日 5:19 PM
To: Haojian Zhuang
Cc: Richard Purdie; kernel-janitors@xxxxxxxxxxxxxxx
Subject: smatch: leds: potential null deref

Hello,

Smatch complains about a potential null dereference but I don't know how
to fix it.  Could you take a look?

drivers/leds/leds-88pm860x.c +269 pm860x_led_probe(28)
	error: potential null derefence 'pdata'.
   256          if (pdev->dev.parent->platform_data) {
   257                  pm860x_pdata = pdev->dev.parent->platform_data;
   258                  pdata = pm860x_pdata->led;
   259          } else
   260                  pdata = NULL;
                        ^^^^^^^^^^^^^

	We set pdata to NULL here.

   261  
   262          data = kzalloc(sizeof(struct pm860x_led), GFP_KERNEL);
   263          if (data == NULL)
   264                  return -ENOMEM;
   265          strncpy(data->name, res->name, MFD_NAME_SIZE);
   266          dev_set_drvdata(&pdev->dev, data);
   267          data->chip = chip;
   268          data->i2c = (chip->id == CHIP_PM8606) ? chip->client : chip->companion;
   269          data->iset = pdata->iset;
                             ^^^^^^^^^^^^

	We dereference it here.

regards,
dan carpenter

Attachment: 0001-led-fix-parameter-checking.patch
Description: 0001-led-fix-parameter-checking.patch


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux