linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] vmscan.c: Invalid strict_strtoul check in write_scan_unevictable_node
@ 2011-09-25 10:59 Kautuk Consul
  2011-09-26  9:20 ` KAMEZAWA Hiroyuki
  2011-09-26 11:29 ` [patch] mm: remove sysctl to manually rescue unevictable pages Johannes Weiner
  0 siblings, 2 replies; 14+ messages in thread
From: Kautuk Consul @ 2011-09-25 10:59 UTC (permalink / raw)
  To: Andrew Morton, Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki,
	Rik van Riel
  Cc: linux-mm, linux-kernel, Kautuk Consul

write_scan_unavictable_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.

Changing this if 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>
---
 mm/vmscan.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index b55699c..73996e6 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3450,8 +3450,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))
-- 
1.7.4.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2011-10-04 10:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-25 10:59 [PATCH 1/1] vmscan.c: Invalid strict_strtoul check in write_scan_unevictable_node Kautuk Consul
2011-09-26  9:20 ` KAMEZAWA Hiroyuki
2011-09-26 11:29 ` [patch] mm: remove sysctl to manually rescue unevictable pages Johannes Weiner
2011-09-26 12:10   ` kautuk.c @samsung.com
2011-09-26 12:29     ` kautuk.c @samsung.com
2011-09-26 14:25       ` Johannes Weiner
2011-09-26 14:55         ` kautuk.c @samsung.com
2011-09-26 14:18     ` Johannes Weiner
2011-09-26 23:11   ` Andrew Morton
2011-09-27  7:27     ` [patch] mm: disable user interface " Johannes Weiner
2011-09-28  2:14       ` Minchan Kim
2011-10-04 10:10         ` Johannes Weiner
2011-09-28  4:51       ` KAMEZAWA Hiroyuki
2011-09-28  1:00   ` [patch] mm: remove sysctl " KOSAKI Motohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).