public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] cifs: change && to ||
@ 2010-04-26 10:10 Dan Carpenter
  2010-04-26 10:44 ` Jeff Layton
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-04-26 10:10 UTC (permalink / raw)
  To: kernel-janitors

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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] cifs: change && to ||
  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
  2010-04-26 19:08 ` Steve French
  2 siblings, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2010-04-26 10:44 UTC (permalink / raw)
  To: kernel-janitors

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.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] cifs: change && to ||
  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
  2010-04-26 19:08 ` Steve French
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-04-26 10:46 UTC (permalink / raw)
  To: kernel-janitors

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] cifs: change && to ||
  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
@ 2010-04-26 19:08 ` Steve French
  2 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2010-04-26 19:08 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Apr 26, 2010 at 5:46 AM, Dan Carpenter <error27@gmail.com> wrote:
> 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.
>> >
>> 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

Merged.


-- 
Thanks,

Steve
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-04-26 19:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2010-04-26 19:08 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox