public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] nfsd: fix comparison in fh_fsid_match()
@ 2015-02-11 13:08 Dan Carpenter
  2015-02-11 13:21 ` Christoph Hellwig
  2015-02-12 20:29 ` J. Bruce Fields
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-02-11 13:08 UTC (permalink / raw)
  To: J. Bruce Fields, Christoph Hellwig; +Cc: linux-nfs, kernel-janitors

We're supposed to be testing that the fh_fsid's match but because the
parenthesis are in the wrong place, then we only check the first
byte.

Fixes: 9558f2500a20 ('nfsd: add fh_fsid_match helper')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
index 84cae20..f229204 100644
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -200,7 +200,7 @@ static inline bool fh_fsid_match(struct knfsd_fh *fh1, struct knfsd_fh *fh2)
 {
 	if (fh1->fh_fsid_type != fh2->fh_fsid_type)
 		return false;
-	if (memcmp(fh1->fh_fsid, fh2->fh_fsid, key_len(fh1->fh_fsid_type) != 0))
+	if (memcmp(fh1->fh_fsid, fh2->fh_fsid, key_len(fh1->fh_fsid_type)) != 0)
 		return false;
 	return true;
 }

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

* Re: [patch] nfsd: fix comparison in fh_fsid_match()
  2015-02-11 13:08 [patch] nfsd: fix comparison in fh_fsid_match() Dan Carpenter
@ 2015-02-11 13:21 ` Christoph Hellwig
  2015-02-11 14:03   ` Dan Carpenter
  2015-02-12 20:29 ` J. Bruce Fields
  1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2015-02-11 13:21 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: J. Bruce Fields, Christoph Hellwig, linux-nfs, kernel-janitors

On Wed, Feb 11, 2015 at 04:08:32PM +0300, Dan Carpenter wrote:
> We're supposed to be testing that the fh_fsid's match but because the
> parenthesis are in the wrong place, then we only check the first
> byte.
> 
> Fixes: 9558f2500a20 ('nfsd: add fh_fsid_match helper')

Thanks, this looks good.  Is there an easy to setup way to check for
these sorts of errors?

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

* Re: [patch] nfsd: fix comparison in fh_fsid_match()
  2015-02-11 13:21 ` Christoph Hellwig
@ 2015-02-11 14:03   ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2015-02-11 14:03 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: J. Bruce Fields, linux-nfs, kernel-janitors

On Wed, Feb 11, 2015 at 02:21:19PM +0100, Christoph Hellwig wrote:
> On Wed, Feb 11, 2015 at 04:08:32PM +0300, Dan Carpenter wrote:
> > We're supposed to be testing that the fh_fsid's match but because the
> > parenthesis are in the wrong place, then we only check the first
> > byte.
> > 
> > Fixes: 9558f2500a20 ('nfsd: add fh_fsid_match helper')
> 
> Thanks, this looks good.  Is there an easy to setup way to check for
> these sorts of errors?

This is a Smatch check I wrote a couple years ago but it never found any
bugs until now so I didn't commit it.  I have done.  I'll push it out
later and Fengguang will eventually add it to the zero day tester bot.

regards,
dan carpenter


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

* Re: [patch] nfsd: fix comparison in fh_fsid_match()
  2015-02-11 13:08 [patch] nfsd: fix comparison in fh_fsid_match() Dan Carpenter
  2015-02-11 13:21 ` Christoph Hellwig
@ 2015-02-12 20:29 ` J. Bruce Fields
  1 sibling, 0 replies; 4+ messages in thread
From: J. Bruce Fields @ 2015-02-12 20:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Christoph Hellwig, linux-nfs, kernel-janitors

On Wed, Feb 11, 2015 at 04:08:32PM +0300, Dan Carpenter wrote:
> We're supposed to be testing that the fh_fsid's match but because the
> parenthesis are in the wrong place, then we only check the first
> byte.

Thanks, I'll pass this along!

--b.

> 
> Fixes: 9558f2500a20 ('nfsd: add fh_fsid_match helper')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
> index 84cae20..f229204 100644
> --- a/fs/nfsd/nfsfh.h
> +++ b/fs/nfsd/nfsfh.h
> @@ -200,7 +200,7 @@ static inline bool fh_fsid_match(struct knfsd_fh *fh1, struct knfsd_fh *fh2)
>  {
>  	if (fh1->fh_fsid_type != fh2->fh_fsid_type)
>  		return false;
> -	if (memcmp(fh1->fh_fsid, fh2->fh_fsid, key_len(fh1->fh_fsid_type) != 0))
> +	if (memcmp(fh1->fh_fsid, fh2->fh_fsid, key_len(fh1->fh_fsid_type)) != 0)
>  		return false;
>  	return true;
>  }

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

end of thread, other threads:[~2015-02-12 20:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 13:08 [patch] nfsd: fix comparison in fh_fsid_match() Dan Carpenter
2015-02-11 13:21 ` Christoph Hellwig
2015-02-11 14:03   ` Dan Carpenter
2015-02-12 20:29 ` J. Bruce Fields

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