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: <ZC2dx2LCLdkEUh02@fedora>
Date:   Wed, 5 Apr 2023 12:11:51 -0400
From:   William Breathitt Gray <william.gray@...aro.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 3/5] iio: addac: stx104: Improve indentation in
 stx104_write_raw()

On Wed, Apr 05, 2023 at 11:50:08AM +0300, Andy Shevchenko wrote:
> On Tue, Apr 04, 2023 at 10:12:00AM -0400, William Breathitt Gray wrote:
> > By bailing out early if chan->output is false for the IIO_CHAN_INFO_RAW,
> > indentation can be decreased by a tab and code readability improved.
> 
> ...
> 
> > +		/* DAC can only accept up to a 16-bit value */
> > +		if ((unsigned int)val > 65535)
> > +			return -EINVAL;
> 
> While the patch is good per se, I don't like two things (which are also in the
> original code):
> - explicit casting (can it be avoided?)

We could explicitly check for negative instead:

    if (val < 0 || val > 65535)

Would that be better?

> - would be good to have U16_MAX or ?.. instead of hard coded number

Fair point, I'll use U16_MAX then.

> Can it be addressed with (additional) patches?

Sure, I'll submit a separate patch to address this.

William Breathitt Gray

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ