Skip to content

Commit

Permalink
RDS: Fix ordering in a conditional
Browse files Browse the repository at this point in the history
Putting the constant first is a supposed "best practice" that actually makes
the code harder to read.

Thanks to Roland Dreier for finding a bug in this "simple, obviously correct"
patch.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andy Grover authored and David S. Miller committed Apr 10, 2009
1 parent 7b70d03 commit 7acd4a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/rds/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages,
nr_pages, write, 0, pages, NULL);
up_read(&current->mm->mmap_sem);

if (0 <= ret && (unsigned) ret < nr_pages) {
if (ret >= 0 && ret < nr_pages) {
while (ret--)
put_page(pages[ret]);
ret = -EFAULT;
Expand Down

0 comments on commit 7acd4a7

Please sign in to comment.