]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
minix: bug widening a binary "not" operation
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 19 Jun 2013 00:08:10 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:27:35 +0000 (17:27 +1000)
"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 a9ed6f36e6ead1d32bf754b50d5eaed3068d6cf2..09b0c96979eca0c5445d11bd58c1b3257689eb5b 100644 (file)
@@ -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;