summaryrefslogtreecommitdiffstats
path: root/mm/swap_slots.c
diff options
context:
space:
mode:
authorRasmus Villemoes2017-07-11 00:49:26 +0200
committerLinus Torvalds2017-07-11 01:32:32 +0200
commitb002529d256307602c669d1886c0b953b52b8700 (patch)
tree9219954404a5b6124356dd8a1785d6f5c0653126 /mm/swap_slots.c
parentfs/proc/task_mmu.c: remove obsolete comment in show_map_vma() (diff)
downloadkernel-qcow2-linux-b002529d256307602c669d1886c0b953b52b8700.tar.gz
kernel-qcow2-linux-b002529d256307602c669d1886c0b953b52b8700.tar.xz
kernel-qcow2-linux-b002529d256307602c669d1886c0b953b52b8700.zip
mm/page_alloc.c: eliminate unsigned confusion in __rmqueue_fallback
Since current_order starts as MAX_ORDER-1 and is then only decremented, the second half of the loop condition seems superfluous. However, if order is 0, we may decrement current_order past 0, making it UINT_MAX. This is obviously too subtle ([1], [2]). Since we need to add some comment anyway, change the two variables to signed, making the counting-down for loop look more familiar, and apparently also making gcc generate slightly smaller code. [1] https://lkml.org/lkml/2016/6/20/493 [2] https://lkml.org/lkml/2017/6/19/345 [akpm@linux-foundation.org: fix up reject fixupping] Link: http://lkml.kernel.org/r/20170621185529.2265-1-linux@rasmusvillemoes.dk Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reported-by: Hao Lee <haolee.swjtu@gmail.com> Acked-by: Wei Yang <weiyang@gmail.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swap_slots.c')
0 files changed, 0 insertions, 0 deletions