[2.6 patch] hwmon/ibmpex.c: fix NULL dereference

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

 



On Wed, Oct 17, 2007 at 12:39:59PM -0700, Nish Aravamudan wrote:
> On 10/17/07, Adrian Bunk <bunk at kernel.org> wrote:
> > Don't dereference "data" when we know for sure it's NULL.
> >
> > Spotted by the Coverity checker.
> >
> > Signed-off-by: Adrian Bunk <bunk at kernel.org>
> >
> > ---
> > 66bec2ef5c6d55fc30ef6ac5bb97fdfcfaf394f2
> > diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
> > index c462824..e14ce3d 100644
> > --- a/drivers/hwmon/ibmpex.c
> > +++ b/drivers/hwmon/ibmpex.c
> > @@ -457,7 +457,7 @@ static void ibmpex_register_bmc(int iface, struct device *dev)
> >         data = kzalloc(sizeof(*data), GFP_KERNEL);
> >         if (!data) {
> >                 printk(KERN_ERR DRVNAME ": Insufficient memory for BMC "
> > -                      "interface %d.\n", data->interface);
> > +                      "interface.\n");
> 
> Hrm but what data->interface would be is specified by the iface
> parameter? Just spit that out instead?

This is only a symptom of the problem that kzalloc() failed, and when 
you are getting into such a situation here you have bigger problems - 
and these are not related to this driver.

Feel free to send a different patch, but IMHO "Insufficient memory" 
alone is enough information in this case.

> Thanks,
> Nish

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed





[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux