[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4822C268.7060501@openvz.org>
Date: Thu, 08 May 2008 13:05:44 +0400
From: Pavel Emelyanov <xemul@...nvz.org>
To: Andrew Morton <akpm@...ux-foundation.org>
CC: Balbir Singh <balbir@...ux.vnet.ibm.com>,
Paul Menage <menage@...gle.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH] Mark res_counter_charge(_locked) with __must_check
Ignoring theirs return value may result in counter underflow
in the future - when the value charged will be uncharged (or in
"leaks" - when the value is not uncharged).
This also prevents from using charging routines to decrement the
counter value (i.e. uncharge it) ;)
(Current code works OK with res_counter, however :) )
Signed-off-by: Pavel Emelyanov <xemul@...nvz.org>
---
diff --git a/include/linux/res_counter.h b/include/linux/res_counter.h
index 6d9e1fc..125660e 100644
--- a/include/linux/res_counter.h
+++ b/include/linux/res_counter.h
@@ -95,8 +95,10 @@ void res_counter_init(struct res_counter *counter);
* counter->limit _locked call expects the counter->lock to be taken
*/
-int res_counter_charge_locked(struct res_counter *counter, unsigned long val);
-int res_counter_charge(struct res_counter *counter, unsigned long val);
+int __must_check res_counter_charge_locked(struct res_counter *counter,
+ unsigned long val);
+int __must_check res_counter_charge(struct res_counter *counter,
+ unsigned long val);
/*
* uncharge - tell that some portion of the resource is released
--
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