Skip to content

Commit 642b704

Browse files
Dan CarpenterAl Viro
authored andcommitted
minix: bug widening a binary "not" operation
"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>
1 parent 18c67cb commit 642b704

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎fs/minix/dir.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static int minix_readdir(struct file *file, struct dir_context *ctx)
9393
unsigned offset;
9494
unsigned long n;
9595

96-
ctx->pos = pos = (pos + chunk_size-1) & ~(chunk_size-1);
96+
ctx->pos = pos = ALIGN(pos, chunk_size);
9797
if (pos >= inode->i_size)
9898
return 0;
9999

0 commit comments

Comments
 (0)