Skip to content

Commit

Permalink
minix: bug widening a binary "not" operation
Browse files Browse the repository at this point in the history
"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 <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Dan Carpenter authored and Al Viro committed Jun 29, 2013
1 parent 18c67cb commit 642b704
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/minix/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 642b704

Please sign in to comment.