lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1107282302580.20477@swampdragon.chaosbits.net>
Date:	Thu, 28 Jul 2011 23:05:51 +0200 (CEST)
From:	Jesper Juhl <jj@...osbits.net>
To:	linux-kernel@...r.kernel.org
cc:	linux-mm@...ck.org, Rik van Riel <riel@...hat.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Minchan Kim <minchan.kim@...il.com>,
	Mel Gorman <mgorman@...e.de>,
	Andrew Morton <akpm@...ux-foundation.org>, kanoj@....com,
	sct@...hat.com
Subject: [PATCH] vmscan: Remove if statement that will never trigger

We have this code in mm/vmscan.c:shrink_slab() :
...
		if (total_scan < 0) {
			printk(KERN_ERR "shrink_slab: %pF negative objects to "
			       "delete nr=%ld\n",
			       shrinker->shrink, total_scan);
			total_scan = max_pass;
		}
...
but since 'total_scan' is of type 'unsigned long' it will never be
less than zero, so there is no way we'll ever enter the true branch of
this if statement - so let's just remove it.

Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
 mm/vmscan.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

	Compile tested only.

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 7ef6912..c07d9b1 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -271,12 +271,6 @@ unsigned long shrink_slab(struct shrink_control *shrink,
 		delta *= max_pass;
 		do_div(delta, lru_pages + 1);
 		total_scan += delta;
-		if (total_scan < 0) {
-			printk(KERN_ERR "shrink_slab: %pF negative objects to "
-			       "delete nr=%ld\n",
-			       shrinker->shrink, total_scan);
-			total_scan = max_pass;
-		}
 
 		/*
 		 * We need to avoid excessive windup on filesystem shrinkers
-- 
1.7.6


-- 
Jesper Juhl <jj@...osbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ