summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorKautuk Consul <consul.kautuk@gmail.com>2011-10-31 17:09:11 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 17:30:49 -0700
commit3f380998aeb51b99d5d22cadb41162e1e9db70d2 (patch)
tree1d5bb20368b06c7b86e7257771209795bd764f00 /mm
parent4e9dc5df46001510ebd3b3e54faa650f474e51a3 (diff)
downloadlinux-stable-3f380998aeb51b99d5d22cadb41162e1e9db70d2.tar.gz
linux-stable-3f380998aeb51b99d5d22cadb41162e1e9db70d2.tar.bz2
linux-stable-3f380998aeb51b99d5d22cadb41162e1e9db70d2.zip
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>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmscan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 51bc4bf3f723..ac644fe85589 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3520,8 +3520,8 @@ static ssize_t write_scan_unevictable_node(struct sys_device *dev,
unsigned long res;
unsigned long req = strict_strtoul(buf, 10, &res);
- if (!req)
- return 1; /* zero is no-op */
+ if (req || !res)
+ return 1; /* Invalid input or zero is no-op */
for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
if (!populated_zone(zone))