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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120131.161535.422381201029777577.davem@davemloft.net>
Date:	Tue, 31 Jan 2012 16:15:35 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	joe@...ches.com
Cc:	asharma@...com, bhelgaas@...gle.com, linux-kernel@...r.kernel.org,
	netdev@...r.kernel.org, glommer@...allels.com, mingo@...e.hu,
	christoph.paasch@...ouvain.be
Subject: Re: [PATCH] net: Disambiguate kernel message

From: Joe Perches <joe@...ches.com>
Date: Tue, 31 Jan 2012 12:55:41 -0800

> On Tue, 2012-01-31 at 12:46 -0800, Arun Sharma wrote:
>> On 1/31/12 12:09 PM, Joe Perches wrote:
>> >> +	too_many_orphans = tcp_too_many_orphans(sk, shift);
>> >> +	out_of_socket_memory = tcp_out_of_memory(sk);
>> >> +	tcp_log_oom(too_many_orphans, out_of_socket_memory);
>> >> +	if (too_many_orphans || out_of_socket_memory) {
>> > Perhaps these repeated three lines should be a routine like:
>> > bool tcp_check_oom(struct sock *sk, int shift)
>> > {
>> > 	bool tcp_orphans = tcp_too_many_orphans(sk, shift);
>> > 	bool tcp_oom = tcp_out_of_memory(sk);
>> >
>> > 	printks...
>> >
>> > 	return tcp_orphans || tcp_oom;
>> > }
>> I like your previous suggestion better. It preserves the ability to write:
>> if (too_many_orphans) {
>>    do_something();
>> }
>> if (out_of_socket_memory) {
>>    do_something_else();
>> }
> 
> shrug. That isn't currently used and 
> tcp_too_many_orphans and tcp_out_of_memory
> could still be checked.
> 
> I think the routine could be moved out-of-line.

Indeed, and make the out-of-line combined routine (that does the test
as well as the conditional logging) return a boolean that determines
if the "if (too_many_orphans || out_of_socket_memory)" test should
pass.
--
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