public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Maneesh Soni <maneesh@in.ibm.com>
Cc: Milton Miller <miltonm@bga.com>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org
Subject: Re: sysfs backing store error path confusion
Date: Wed, 3 Nov 2004 13:42:09 -0800	[thread overview]
Message-ID: <20041103214209.GB30482@kroah.com> (raw)
In-Reply-To: <20041102160334.GB3191@in.ibm.com>

On Tue, Nov 02, 2004 at 10:03:34AM -0600, Maneesh Soni wrote:
> On Tue, Nov 02, 2004 at 02:46:58AM -0600, Milton Miller wrote:
> > sysfs_new_dirent returns ERR_PTR(-ENOMEM) if kmalloc fails but the callers
> > were expecting NULL.  
> > 
> > Compile & link tested.  (Yes, changing the callee would be a smaller change).
> > 
> 
> Thanks for spotting this. But as you said, I will prefer to change the callee.
> How about this patch? 
> 
> Andrew, Greg, please include this if found ok.
> 
> Thanks
> Maneesh
> 
> 
> 
> o sysfs_new_dirent to retrun NULL if kmalloc fails. Thanks to Milton Miller 
>   for spotting this.
> 
> Signed-off-by: <maneesh@in.ibm.com>
> ---
> 
>  linux-2.6.10-rc1-bk12-maneesh/fs/sysfs/dir.c |    2 +-
>  1 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff -puN fs/sysfs/dir.c~fix-sysfs_new_dirent-return fs/sysfs/dir.c
> --- linux-2.6.10-rc1-bk12/fs/sysfs/dir.c~fix-sysfs_new_dirent-return	2004-11-02 08:38:57.000000000 -0600
> +++ linux-2.6.10-rc1-bk12-maneesh/fs/sysfs/dir.c	2004-11-02 09:17:18.000000000 -0600
> @@ -38,7 +38,7 @@ static struct sysfs_dirent * sysfs_new_d
>  
>  	sd = kmalloc(sizeof(*sd), GFP_KERNEL);
>  	if (!sd)
> -		return -ENOMEM;
> +		return NULL;

Actually, this needs to be a 0, not NULL, otherwise the compiler
complains with a warning.  I've fixed it up and applied it.

thanks,

greg k-h

  reply	other threads:[~2004-11-03 21:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-02  8:46 sysfs backing store error path confusion Milton Miller
2004-11-02 16:03 ` Maneesh Soni
2004-11-03 21:42   ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-11-05  7:49 Milton Miller
2004-11-06  6:20 ` Maneesh Soni
2004-11-12 20:49 ` Greg KH

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=20041103214209.GB30482@kroah.com \
    --to=greg@kroah.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maneesh@in.ibm.com \
    --cc=miltonm@bga.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox