linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: incorrect overflow check in shrink_slab()
@ 2011-12-01  9:20 Xi Wang
  2011-12-01  9:32 ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 5+ messages in thread
From: Xi Wang @ 2011-12-01  9:20 UTC (permalink / raw)
  To: Andrew Morton, Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki,
	Johannes Weiner
  Cc: linux-mm, linux-kernel

total_scan is unsigned long, so the overflow check (total_scan < 0)
didn't work.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
 mm/vmscan.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index a1893c0..46a04e7 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -270,7 +270,7 @@ unsigned long shrink_slab(struct shrink_control *shrink,
 		delta *= max_pass;
 		do_div(delta, lru_pages + 1);
 		total_scan += delta;
-		if (total_scan < 0) {
+		if ((long)total_scan < 0) {
 			printk(KERN_ERR "shrink_slab: %pF negative objects to "
 			       "delete nr=%ld\n",
 			       shrinker->shrink, total_scan);
-- 
1.7.5.4


--
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	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-02  2:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-01  9:20 [PATCH] mm: incorrect overflow check in shrink_slab() Xi Wang
2011-12-01  9:32 ` KAMEZAWA Hiroyuki
2011-12-01  9:57   ` Xi Wang
2011-12-01 20:54   ` Andrew Morton
2011-12-02  2:00     ` Xi Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox