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]
Message-ID: <Y1knRM2jU8RhlFWn@sirena.org.uk>
Date:   Wed, 26 Oct 2022 13:25:40 +0100
From:   Mark Brown <broonie@...nel.org>
To:     Takashi Iwai <tiwai@...e.de>
Cc:     wangkailong@...i.cn, perex@...ex.cz, tiwai@...e.com,
        lgirdwood@...il.com, motolav@...il.com, cezary.rojewski@...el.com,
        mkumard@...dia.com, pierre-louis.bossart@...ux.intel.com,
        kai.vehmanen@...ux.intel.com, peter.ujfalusi@...ux.intel.com,
        alsa-devel@...a-project.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ALSA/ASoC: replace ternary operator with min()

On Wed, Oct 26, 2022 at 07:28:26AM +0200, Takashi Iwai wrote:
> Mark Brown wrote:
> > On Tue, Oct 25, 2022 at 10:56:11PM +0800, wangkailong@...i.cn wrote:

> > > sound/soc/soc-ops.c:817: WARNING opportunity for min()

> > >  	kfree(uctl);
> > > -	return err < 0 ? err : 0;
> > > +	return min(err, 0);

> > I don't think this is a good warning, while I'm no big fan of the
> > ternery operator the new code is less clear about the intent than the
> > old code.

> Agreed.  That use of ternery is a standard idiom.

> If we have to eliminate the use of ternery inevitably, it'd be better
> to introduce a new macro for clarity instead.

It looks like it's more about identifying a pattern that could be min()
but not being able to detect the semantics of why we're comparing
numbers.

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ