All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@kernel.org>
To: Nish Aravamudan <nish.aravamudan@gmail.com>
Cc: "Darrick J. Wong" <djwong@us.ibm.com>,
	"Mark M. Hoffman" <mhoffman@lightlink.com>,
	lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [lm-sensors] [2.6 patch] hwmon/ibmpex.c: fix NULL dereference
Date: Wed, 17 Oct 2007 19:50:36 +0000	[thread overview]
Message-ID: <20071017195036.GC3778@stusta.de> (raw)
In-Reply-To: <29495f1d0710171239i30776a2ci6db65c4f135b0754@mail.gmail.com>

On Wed, Oct 17, 2007 at 12:39:59PM -0700, Nish Aravamudan wrote:
> On 10/17/07, Adrian Bunk <bunk@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@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


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Adrian Bunk <bunk@kernel.org>
To: Nish Aravamudan <nish.aravamudan@gmail.com>
Cc: "Darrick J. Wong" <djwong@us.ibm.com>,
	"Mark M. Hoffman" <mhoffman@lightlink.com>,
	lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [2.6 patch] hwmon/ibmpex.c: fix NULL dereference
Date: Wed, 17 Oct 2007 21:50:36 +0200	[thread overview]
Message-ID: <20071017195036.GC3778@stusta.de> (raw)
In-Reply-To: <29495f1d0710171239i30776a2ci6db65c4f135b0754@mail.gmail.com>

On Wed, Oct 17, 2007 at 12:39:59PM -0700, Nish Aravamudan wrote:
> On 10/17/07, Adrian Bunk <bunk@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@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


  reply	other threads:[~2007-10-17 19:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17 19:29 [lm-sensors] [2.6 patch] hwmon/ibmpex.c: fix NULL dereference Adrian Bunk
2007-10-17 19:29 ` Adrian Bunk
2007-10-17 19:39 ` [lm-sensors] " Nish Aravamudan
2007-10-17 19:39   ` Nish Aravamudan
2007-10-17 19:50   ` Adrian Bunk [this message]
2007-10-17 19:50     ` Adrian Bunk
2007-10-17 20:58 ` [lm-sensors] " Jean Delvare
2007-10-17 20:58   ` Jean Delvare
2007-10-17 22:15   ` [lm-sensors] [PATCH] ibmpex: Change printk to dev_{info, err} macros Darrick J. Wong
2007-10-17 22:15     ` [PATCH] ibmpex: Change printk to dev_{info,err} macros Darrick J. Wong
2007-10-19  8:54     ` [lm-sensors] [PATCH] ibmpex: Change printk to dev_{info, Jean Delvare
2007-10-19  8:54       ` [PATCH] ibmpex: Change printk to dev_{info,err} macros Jean Delvare
2007-10-19 23:35       ` [lm-sensors] [PATCH v2] ibmpex: Change printk to dev_{info, Darrick J. Wong
2007-10-19 23:35         ` [PATCH v2] ibmpex: Change printk to dev_{info,err} macros Darrick J. Wong
2007-10-20 21:30         ` [lm-sensors] [PATCH v2] ibmpex: Change printk to dev_{info, Jean Delvare
2007-10-20 21:30           ` [PATCH v2] ibmpex: Change printk to dev_{info,err} macros Jean Delvare
2007-10-23 11:23           ` [lm-sensors] [PATCH v2] ibmpex: Change printk to dev_{info, Mark M. Hoffman
2007-10-23 11:23             ` [PATCH v2] ibmpex: Change printk to dev_{info,err} macros Mark M. Hoffman
2007-10-17 21:10 ` [lm-sensors] [2.6 patch] hwmon/ibmpex.c: fix NULL dereference Darrick J. Wong
2007-10-17 21:10   ` Darrick J. Wong
2007-10-18 13:34 ` [lm-sensors] " Mark M. Hoffman
2007-10-18 13:34   ` Mark M. Hoffman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071017195036.GC3778@stusta.de \
    --to=bunk@kernel.org \
    --cc=djwong@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=mhoffman@lightlink.com \
    --cc=nish.aravamudan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.