From: Jim Rees <rees@umich.edu>
To: Bruce Fields <bfields@fieldses.org>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH v2] nfsd: avoid undefined signed overflow
Date: Fri, 17 May 2013 18:30:56 -0400 [thread overview]
Message-ID: <20130517223056.GA2776@umich.edu> (raw)
In-Reply-To: <20130517214031.GA14005@fieldses.org>
Bruce Fields wrote:
On Fri, May 17, 2013 at 05:33:00PM -0400, Jim Rees wrote:
> In C, signed integer overflow results in undefined behavior, but unsigned
> overflow wraps around. So do the subtraction first, then cast to signed.
Thanks! Applying for 3.11.
(I wonder if it actually bites anyone in practice? Are there common
compilers or architectures where this makes a difference? Even if so I
suppose that many generations is probably unlikely enough not to make
this worth backporting to stable branches.)
I tested on the architectures I have at my fingertips and it made no
difference. My guess is you might need a one's complement architecture. Of
course we'll never see wraparound in our lifetimes, so no sense backporting
this.
I actually used a one's complement machine many years ago, a CDC 6600. I
don't think linux has been ported to it.
next prev parent reply other threads:[~2013-05-17 22:31 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 [this message]
2013-05-18 11:04 ` Bernd Petrovitsch
2013-05-18 14:58 ` Jim Rees
2013-05-18 15:49 ` Bernd Petrovitsch
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=20130517223056.GA2776@umich.edu \
--to=rees@umich.edu \
--cc=bfields@fieldses.org \
--cc=linux-nfs@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 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).