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: <20091020085820.e312a38b.rdunlap@xenotime.net>
Date:	Tue, 20 Oct 2009 08:58:20 -0700
From:	Randy Dunlap <rdunlap@...otime.net>
To:	Tilman Schmidt <tilman@...p.cc>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andy Whitcroft <apw@...onical.com>
Subject: Re: checkpatch.pl false positive?
 "ERROR: do not use assignment in if condition"

On Tue, 20 Oct 2009 17:50:45 +0200 Tilman Schmidt wrote:

> The command
> ./scripts/checkpatch.pl -f drivers/isdn/gigaset/bas-gigaset.c 
> produces a lot of "ERROR" messages like these:
> 
> ERROR: do not use assignment in if condition
> #608: FILE: isdn/gigaset/bas-gigaset.c:608:
> +       if ((ret = usb_submit_urb(ucs->urb_cmd_in, GFP_ATOMIC)) != 0) {
> 
> ERROR: do not use assignment in if condition
> #745: FILE: isdn/gigaset/bas-gigaset.c:745:
> +               if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) {
> 
> ERROR: do not use assignment in if condition
> #753: FILE: isdn/gigaset/bas-gigaset.c:753:
> +               if ((rc = atread_submit(cs, BAS_TIMEOUT)) < 0) {
> 
> As far as I can see there's nothing wrong with these lines. In particular,
> I cannot find anything in Documentation/CodingStyle that would prohibit an
> assignment inside an 'if' condition.

Yes, we don't try to list Every Possible Problem in CodingStyle,
but emails on lkml over the past several years try to discourage such
assignments inside if's because they can be confusing, difficult to read,
and generally are not helping to produce any better code output than
using:
	ret = usb_submit_urb(args);
	if (ret) {
		foo;
		bar;
		blah();
	}

> PS: I know the file has other problems. That's why I'm trying to
> checkpatch it in the first place.



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