summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilad Ben-Yossef <gilad@benyossef.com>2017-02-27 23:28:27 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-28 03:43:46 +0100
commit1d5210ef706523529d3cc16fd70be0a466253466 (patch)
treedf71a8925d056f4a7ac94077b6b3f86a5d10c0e2
parentipc/shm: Fix shmat mmap nil-page protection (diff)
downloadlinux-1d5210ef706523529d3cc16fd70be0a466253466.tar.xz
linux-1d5210ef706523529d3cc16fd70be0a466253466.zip
scatterlist: reorder compound boolean expression
Test the cheaper boolean expression with no side effects first. Link: http://lkml.kernel.org/r/1486040150-14109-2-git-send-email-gilad@benyossef.com Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: <ofir.drang@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--lib/scatterlist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 004fc70fc56a..393920fddcb9 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -666,7 +666,7 @@ size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, void *buf,
local_irq_save(flags);
- while (sg_miter_next(&miter) && offset < buflen) {
+ while ((offset < buflen) && sg_miter_next(&miter)) {
unsigned int len;
len = min(miter.length, buflen - offset);