Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dan Carpenter and committed by
Al Viro
642b704c 18c67cb9

+1 -1
+1 -1
fs/minix/dir.c
··· 93 93 unsigned offset; 94 94 unsigned long n; 95 95 96 - ctx->pos = pos = (pos + chunk_size-1) & ~(chunk_size-1); 96 + ctx->pos = pos = ALIGN(pos, chunk_size); 97 97 if (pos >= inode->i_size) 98 98 return 0; 99 99