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]
Date:   Tue, 24 Oct 2023 17:56:47 +0200 (GMT+02:00)
From:   Thomas Weißschuh  <thomas@...ch.de>
To:     Jeff LaBundy <jeff@...undy.com>
Cc:     Anshul Dalal <anshulusr@...il.com>, linux-input@...r.kernel.org,
        devicetree@...r.kernel.org,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Thomas Weißschuh <linux@...ssschuh.net>,
        Shuah Khan <skhan@...uxfoundation.org>,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 2/2] input: joystick: driver for Adafruit Seesaw
 Gamepad

Hi Jeff,

Oct 23, 2023 23:24:55 Jeff LaBundy <jeff@...undy.com>:
> On Mon, Oct 23, 2023 at 07:55:52AM +0200, Thomas Weißschuh  wrote:
>
> [...]
>
>>>> +   err = i2c_master_send(client, write_buf, sizeof(write_buf));
>>>> +   if (err < 0)
>>>> +       return err;
>>>
>>> You correctly return err (or rather, ret) for negative values, but you should also
>>> check that ret matches the size of the data sent. For 0 <= ret < sizeof(writebuf),
>>> return -EIO.
>>
>> The driver did this originally.
>> I then requested it to be removed as this case
>> can never happen.
>> i2c_master_send will either return size of(writebuf) or an error.
>
> Great catch; indeed you are correct. Apologies for having missed this
> in the change log; this is good to know in the future.

I guess it would make sense to also adapt the
function documentation to be more explicit
about this invariant.
No need to complicate every caller unnecessarily.

I can send a patch somewhere next week, but
if you want to send one I'll be happy to review it.

> That being said, it's a moot point IMO; this driver seems like a good
> candidate for regmap. If regmap cannot be made to work here for some
> reason, then I'd like to at least see some wrapper functions to avoid
> duplicate code and manual assignments to a buffer.

Ack.

Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ