From: Dan Carpenter <dan.carpenter@oracle.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] minix: bug widening a binary "not" operation
Date: Thu, 16 May 2013 07:51:49 +0000 [thread overview]
Message-ID: <20130516075148.GA7494@elgon.mountain> (raw)
"chunk_size" is an unsigned int and "pos" is an unsigned long. The
"& ~(chunk_size-1)" operation clears the high 32 bits unintentionally.
The ALIGN() macro does the correct thing.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index a9ed6f3..09b0c96 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -95,7 +95,7 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
char *name;
__u32 inumber;
- pos = (pos + chunk_size-1) & ~(chunk_size-1);
+ pos = ALIGN(pos, chunk_size);
if (pos >= inode->i_size)
goto done;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] minix: bug widening a binary "not" operation
Date: Thu, 16 May 2013 10:51:49 +0300 [thread overview]
Message-ID: <20130516075148.GA7494@elgon.mountain> (raw)
"chunk_size" is an unsigned int and "pos" is an unsigned long. The
"& ~(chunk_size-1)" operation clears the high 32 bits unintentionally.
The ALIGN() macro does the correct thing.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index a9ed6f3..09b0c96 100644
--- a/fs/minix/dir.c
+++ b/fs/minix/dir.c
@@ -95,7 +95,7 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
char *name;
__u32 inumber;
- pos = (pos + chunk_size-1) & ~(chunk_size-1);
+ pos = ALIGN(pos, chunk_size);
if (pos >= inode->i_size)
goto done;
next reply other threads:[~2013-05-16 7:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 7:51 Dan Carpenter [this message]
2013-05-16 7:51 ` [patch] minix: bug widening a binary "not" operation Dan Carpenter
2013-05-29 22:28 ` Andrew Morton
2013-05-29 22:28 ` Andrew Morton
2013-05-30 6:52 ` Dan Carpenter
2013-05-30 6:52 ` Dan Carpenter
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=20130516075148.GA7494@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.