minix: bug widening a binary "not" operation
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 19 Jun 2013 00:08:10 +0000 (10:08 +1000)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 29 Jun 2013 08:57:35 +0000 (12:57 +0400)
"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>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/minix/dir.c

index 08c442902fcdbf9ec5a9039621f8b8900ea6bf0e..dfaf6fa9b7b52a28bcb00ce3c4cd3df817158814 100644 (file)
@@ -93,7 +93,7 @@ static int minix_readdir(struct file *file, struct dir_context *ctx)
        unsigned offset;
        unsigned long n;
 
-       ctx->pos = pos = (pos + chunk_size-1) & ~(chunk_size-1);
+       ctx->pos = pos = ALIGN(pos, chunk_size);
        if (pos >= inode->i_size)
                return 0;