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: <47516b38-58e1-e3c9-1ac2-7b8d8586566e@gmail.com>
Date:   Wed, 27 Jul 2022 23:44:42 +0800
From:   Potin Lai <potin.lai.pt@...il.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Patrick Williams <patrick@...cx.xyz>,
        Potin Lai <potin.lai@...ntatw.com>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/1] iio: humidity: hdc100x: add manufacturer and
 device ID cehck


Andy Shevchenko 於 7/27/2022 7:56 PM 寫道:
> On Wed, Jul 27, 2022 at 12:42 PM Potin Lai <potin.lai.pt@...il.com> wrote:
>> On 7/27/22 18:00, Andy Shevchenko wrote:
>>> On Wed, Jul 27, 2022 at 8:46 AM Potin Lai <potin.lai.pt@...il.com> wrote:
> ...
>
>>>> +       data = device_get_match_data(&client->dev);
>>>> +       if (data) {
>>> This check is redundant. Too much protective programming. Just oblige
>>> that matched ID has to always have an associated data.
>> Is it guaranteed that device_get_match_data will not return NULL? I find some examples in other drivers, all of them have a check on returned data.
> No, but as I said you may guarantee that by obliging developers not to
> shoot in their feet.
Thanks for the explanation, I will remove the checking part.

Potin
>> Will it be more appropriate if I move device_get_match_data to probe function, and return EINVAL when we get a NULL pointer from device_get_match_data?
> Why is this check needed? We do not like dead code.
>
>>>> +               if (!data->support_mfr_check)
>>>> +                       return true;
>>>> +       }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ