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:	Mon, 29 Sep 2014 22:40:04 +0200
From:	Andreas Mohr <andi@...as.de>
To:	Ondrej Zary <linux@...nbow-software.org>
Cc:	alsa-devel@...a-project.org, Andreas Mohr <andi@...as.de>,
	Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] ES938 support for ES18xx driver

Hi,

On Mon, Sep 29, 2014 at 09:50:42PM +0200, Ondrej Zary wrote:
> +	if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT)
> +		/* no error if this fails because ES938 is optional */
> +		if (snd_es938_init(&chip->es938, card, 0, 0) == 0)
> +			snd_printk(KERN_DEBUG "found ES938 audio processor\n");
> +
> +	return 0;

Hmm, how's the braces policy here?
Given a double "if" I'd suspect that the outer "if" would want braces then.
(perhaps checkpatch.pl has something to say here)

Not to mention that I'm having strong doubts about the kernel's
"if" coding style guidelines in general:
IMHO *all* uses of "if" ought to be braced:
witness the Apple-specific OpenSSL bug catastrophy ("goto fail;"),
where people said that adding braces to conditionals would have made things
obvious.
Plus the annoyance that for an addition commit to an existing conditional
the diff will *not* contain the addition only (one line),
but rather *three* lines, and the first line rather needlessly getting
modified even!

+ if (is_foo)
+   bar;

So, given a ridiculously simple one-line addition:

- if (is_foo)
+ if (is_foo) {
    bar;
+   boo;
+ }

Rather than:

+ if (is_foo) {
+   bar;
+ }

if (is_foo) {
  bar;
+ boo;
}


(SIX changed lines vs. 4!)


Not to mention my pet peeve about large sections of coding style documents -
they establish Golden Rules to never be broken, but then
Fail To Elaborate Why - STUPID!
(that does not fully apply to our "if" CodingStyle paragraph though)
What a great way to hamper properly thought out evolution of guidelines...

Perhaps we should have a seasoned discussion about that coding style issue,
and others? (any update of Documentation/CodingStyle
would need to directly include an update to checkpatch.pl, too, though)

(sorry about that part being rather OT to your particular nice patch)

> +	struct snd_es938_sysex_reg req = {
> +		.midi_cmd = MIDI_CMD_COMMON_SYSEX,
> +		.id = ES938_ID,
> +		.cmd = ES938_CMD_REG_R,
> +		.reg = reg,
> +		.midi_end = MIDI_CMD_COMMON_SYSEX_END,
> +	};

Hmm, perhaps const? :)
(and dito probably a const void * cast further below, to forego receiving
the optionally activated gcc non-const cast warnings)

> +	end_time = ktime_add_ms(ktime_get(), 100);

Yay! One driver less which is advertising
less precise deprecated implementation style :)

> +	/* check if the reply is our and has SYSEX_END at the end */

"ours"

Thanks,

Andreas Mohr
--
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