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-prev] [day] [month] [year] [list]
Date:	Thu, 26 Jun 2008 05:22:18 +0530
From:	Balbir Singh <balbir@...ux.vnet.ibm.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	yamamoto@...inux.co.jp, menage@...gle.com,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	kamezawa.hiroyu@...fujitsu.com
Subject: Re: [1/2] memrlimit handle attach_task() failure, add can_attach()
 callback

Andrew Morton wrote:
> On Fri, 20 Jun 2008 20:31:42 +0530
> Balbir Singh <balbir@...ux.vnet.ibm.com> wrote:
> 
>> +/*
>> + * Add the value val to the resource counter and check if we are
>> + * still under the limit.
>> + */
>> +static inline bool res_counter_add_check(struct res_counter *cnt,
>> +						unsigned long val)
>> +{
>> +	bool ret = false;
>> +	unsigned long flags;
>> +
>> +	spin_lock_irqsave(&cnt->lock, flags);
>> +	if (cnt->usage + val <= cnt->limit)
>> +		ret = true;
>> +	spin_unlock_irqrestore(&cnt->lock, flags);
>> +	return ret;
>> +}
> 
> The comment and the function name imply that thins function will "Add
> the value val to the resource counter".  But it doesn't do that at all.
> In fact the first arg could be a `const struct res_counter *'.
> 
> Perhaps res_counter_can_add() would be more accurate.

Will fix both problems and send out fixes. I intended to call it
res_counter_check_and_add(), but I don't like "and" in function names.
res_counter_can_add is definitely better.


-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
--
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