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>] [day] [month] [year] [list]
Date:	Tue,  9 Nov 2010 12:21:58 -0800
From:	Greg Thelen <gthelen@...gle.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Daisuke Nishimura <nishimura@....nes.nec.co.jp>,
	Johannes Weiner <hannes@...xchg.org>,
	Wu Fengguang <fengguang.wu@...el.com>,
	Minchan Kim <minchan.kim@...il.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, Greg Thelen <gthelen@...gle.com>
Subject: [PATCH] memcg: mark mem_cgroup_page_stat() underflow unlikely

Add unlikely() to indicate that underflow of per-cpu counter
sum is not expected.

The underflow is already handled, but should have been
marked unlikely.

Reported-by: Wu Fengguang <fengguang.wu@...el.com>
Signed-off-by: Greg Thelen <gthelen@...gle.com>
---
 mm/memcontrol.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ed070d0..e8fbade 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1393,7 +1393,7 @@ unsigned long mem_cgroup_page_stat(struct mem_cgroup *mem,
 	 * value.  This function returns an unsigned value, so round it up to
 	 * zero to avoid returning a very large value.
 	 */
-	if (value < 0)
+	if (unlikely(value < 0))
 		value = 0;
 
 	put_online_cpus();
-- 
1.7.3.1

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