linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
To: Jim Rees <rees@umich.edu>
Cc: Bruce Fields <bfields@fieldses.org>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2] nfsd: avoid undefined signed overflow
Date: Sat, 18 May 2013 17:49:11 +0200	[thread overview]
Message-ID: <1368892155.11003.39.camel@thorin> (raw)
In-Reply-To: <20130518145808.GA3670@umich.edu>

On Sam, 2013-05-18 at 10:58 -0400, Jim Rees wrote:
> Bernd Petrovitsch wrote:
> 
>   Hmm, what is actually wrong with plain-old
>   ----  snip  ----
>   static bool stateid_generation_after(stateid_t *a, stateid_t *b)
>   {
>   	return a->si_generation > b->si_generation;
>   }
>   ----  snip  ----
>   ?
> 
> It doesn't account for wraparound. Try this:
> 
>     unsigned int a = 0xffff0000, b = 0x7fff0000;
>     printf("%d %d\n", a > b, (int)(a - b) > 0);
> 
> I just realized that I said this needed a comment, then didn't provide one.

Ooops, yes, thx.
Sry for the noise;-)

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd@petrovitsch.priv.at
                     LUGA : http://www.luga.at


      reply	other threads:[~2013-05-18 15:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-17 21:33 [PATCH v2] nfsd: avoid undefined signed overflow Jim Rees
2013-05-17 21:40 ` Bruce Fields
2013-05-17 22:30   ` Jim Rees
2013-05-18 11:04 ` Bernd Petrovitsch
2013-05-18 14:58   ` Jim Rees
2013-05-18 15:49     ` Bernd Petrovitsch [this message]

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=1368892155.11003.39.camel@thorin \
    --to=bernd@petrovitsch.priv.at \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=rees@umich.edu \
    /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;
as well as URLs for NNTP newsgroup(s).