linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@openvz.org>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] fs: fix integer overflow in MS_NOUSER definition
Date: Sat, 21 Apr 2012 09:49:49 +0400	[thread overview]
Message-ID: <20120421054949.32549.2823.stgit@zurg> (raw)

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).

Other potential bugs: git grep -w -e '1\s*<<\s*31'

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
---
 include/linux/fs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6b71bd6..903bf00 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -217,7 +217,7 @@ struct inodes_stat_t {
 #define MS_NOSEC	(1<<28)
 #define MS_BORN		(1<<29)
 #define MS_ACTIVE	(1<<30)
-#define MS_NOUSER	(1<<31)
+#define MS_NOUSER	(1u<<31)
 
 /*
  * Superblock flags that can be altered by MS_REMOUNT


             reply	other threads:[~2012-04-21  5:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-21  5:49 Konstantin Khlebnikov [this message]
2012-04-21  6:28 ` [PATCH] fs: fix integer overflow in MS_NOUSER definition Al Viro
2012-04-21  8:37   ` Konstantin Khlebnikov

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=20120421054949.32549.2823.stgit@zurg \
    --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).