All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] cifs: change && to ||
Date: Mon, 26 Apr 2010 10:46:43 +0000	[thread overview]
Message-ID: <20100426104643.GR29093@bicker> (raw)
In-Reply-To: <20100426101006.GQ29093@bicker>

On Mon, Apr 26, 2010 at 06:44:01AM -0400, Jeff Layton wrote:
> On Mon, 26 Apr 2010 12:10:06 +0200
> Dan Carpenter <error27@gmail.com> wrote:
> 
> > This is a typo, if pvolume_info were NULL it would oops.
> > 
> > This function is used in clean up and error handling.  The current code
> > never passes a NULL pvolume_info, but it could pass a NULL *pvolume_info
> > if the kmalloc() failed.
> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > 
> > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> > index d9566bf..85a35a4 100644
> > --- a/fs/cifs/connect.c
> > +++ b/fs/cifs/connect.c
> > @@ -2262,7 +2262,7 @@ cleanup_volume_info(struct smb_vol **pvolume_info)
> >  {
> >  	struct smb_vol *volume_info;
> >  
> > -	if (!pvolume_info && !*pvolume_info)
> > +	if (!pvolume_info || !*pvolume_info)
> >  		return;
> >  
> >  	volume_info = *pvolume_info;
> 
> Good catch. I wonder though whether we can just eliminate that check
> altogether? In any case, this is clearly correct in the short term.

Nah, we can't.  If the kmalloc() that allocates *pvolume_info fails it
would lead to an OOPs.

regards,
dan carpenter

> 
> Acked-by: Jeff Layton <jlayton@redhat.com>

  parent reply	other threads:[~2010-04-26 10:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-26 10:10 [patch] cifs: change && to || Dan Carpenter
2010-04-26 10:44 ` Jeff Layton
2010-04-26 10:46 ` Dan Carpenter [this message]
2010-04-26 19:08 ` Steve French

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=20100426104643.GR29093@bicker \
    --to=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    /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.