Commit 3f380998aeb51b99d5d22cadb41162e1e9db70d2
Committed by
Linus Torvalds
1 parent
4e9dc5df46
Exists in
master
and in
6 other branches
vmscan.c: fix invalid strict_strtoul() check in write_scan_unevictable_node()
write_scan_unevictable_node() checks the value req returned by strict_strtoul() and returns 1 if req is 0. However, when strict_strtoul() returns 0, it means successful conversion of buf to unsigned long. Due to this, the function was not proceeding to scan the zones for unevictable pages even though we write a valid value to the scan_unevictable_pages sys file. Change this check slightly to check for invalid value in buf as well as 0 value stored in res after successful conversion via strict_strtoul. In both cases, we do not perform the scanning of this node's zones. Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Johannes Weiner <jweiner@redhat.com> Cc: Lee Schermerhorn <lee.schermerhorn@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
mm/vmscan.c
... | ... | @@ -3520,8 +3520,8 @@ |
3520 | 3520 | unsigned long res; |
3521 | 3521 | unsigned long req = strict_strtoul(buf, 10, &res); |
3522 | 3522 | |
3523 | - if (!req) | |
3524 | - return 1; /* zero is no-op */ | |
3523 | + if (req || !res) | |
3524 | + return 1; /* Invalid input or zero is no-op */ | |
3525 | 3525 | |
3526 | 3526 | for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) { |
3527 | 3527 | if (!populated_zone(zone)) |