linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fs: fix integer overflow in MS_NOUSER definition
Date: Sat, 21 Apr 2012 12:37:19 +0400	[thread overview]
Message-ID: <4F9271BF.4000302@openvz.org> (raw)
In-Reply-To: <20120421062838.GS6871@ZenIV.linux.org.uk>

Al Viro wrote:
> On Sat, Apr 21, 2012 at 09:49:49AM +0400, Konstantin Khlebnikov wrote:
>> MS_NOUSER defined as signed int (1<<31), sb->s_flags declared as unsigned long.
>> So (sb->s_flags&  MS_NOUSER) works as (sb->s_flags&  0xffffffff80000000).
>
> ... and it's not a problem since we can't use bits 32 and above anyway -
> unsigned long is 32bit on a lot of platforms.  I have no objections to
> making that 1U<<31, but it's not a bug, let alone an integer overflow.

Yes, it's not a bug here, but I not sure about the rest thousand places, where
similar expressions are used. Probably checkpatch should warn about such things.

BTW this patch makes code smaller =)

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16 (-16)
function                                     old     new   delta
graft_tree                                   135     119     -16

      reply	other threads:[~2012-04-21  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-21  5:49 [PATCH] fs: fix integer overflow in MS_NOUSER definition Konstantin Khlebnikov
2012-04-21  6:28 ` Al Viro
2012-04-21  8:37   ` Konstantin Khlebnikov [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=4F9271BF.4000302@openvz.org \
    --to=khlebnikov@openvz.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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).