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: <4659C828.80503@intel.com>
Date:	Sun, 27 May 2007 11:04:24 -0700
From:	"Kok, Auke" <auke-jan.h.kok@...el.com>
To:	Jan Engelhardt <jengelh@...ux01.gwdg.de>
Cc:	randy.dunlap@...cle.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] [condingstyle] Add chapter on tests

Jan Engelhardt wrote:
> On May 25 2007 10:25, Auke Kok wrote:
>> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
>> index f518395..3635b38 100644
>> --- a/Documentation/CodingStyle
>> +++ b/Documentation/CodingStyle
>> @@ -393,7 +393,7 @@ int fun(int a)
>> 	int result = 0;
>> 	char *buffer = kmalloc(SIZE);
>>
>> -	if (buffer == NULL)
>> +	if (!buffer)
>> 		return -ENOMEM;
> 
> Please don't do this. With ==NULL/!=NULL, it is clear what
> <randomvariable> could be (integer or pointer) without needing
> to look it up. It also reads quite strange: "if not buffer".
> For bools ('adjectives' / 'is a'), it works, not so much for ptrs.
> Hence:
> 
>> +If you give your variables and pointers good names, there is never a need
>> +to compare the value stored in that variable to NULL or true/false, so
>> +omit all that and keep it short.
> 
>> +	ptr = s->next;
>> +	if (!ptr)
>> +		return;
> 
> Not agreed.

that piece is a copy of mm/slab.c, and all over the core components of the 
kernel (even fs/inode.c written by Linus). I strongly think that "== NULL" 
doesn't add anything and that well-written functions and well-named variables 
really do not need the extra fluff.

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