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]
Message-ID: <CAFRkauCQ-BTbad8dgDgduDA8QCFTxbocmLxU+sKErUB8WO4bzQ@mail.gmail.com>
Date:   Thu, 3 Jun 2021 19:20:57 +0800
From:   Axel Lin <axel.lin@...ics.com>
To:     cy_huang(黃啟原) <cy_huang@...htek.com>
Cc:     "broonie@...nel.org" <broonie@...nel.org>,
        "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] regulator: rt4801: Fix NULL pointer dereference if
 priv->enable_gpios is NULL

cy_huang(黃啟原) <cy_huang@...htek.com> 於 2021年6月3日 週四 下午6:39寫道:
>
> Hi, Axel:
>
> Which case will cause this error? I'm not really sure.
> But if devm_gpiod_get_array_optional will return null, then it must be check
> earlier in probe function
>
>         priv->enable_gpios = devm_gpiod_get_array_optional(&i2c->dev, "enable",
> GPIOD_OUT_HIGH);
> -       if (IS_ERR(priv->enable_gpios)) {+       if (IS_ERR_OR_NULL(priv->enable_gpios)) {
>
> If so, this change will be more reasonable.
> Cause in binding document, I already write the min item must be '1'.

Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.yaml
  enable-gpios:
    description: GPIOs to use to enable DSVP/DSVN regulator.
      The first one is ENP to enable DSVP, and second one is ENM to enable DSVN.
      Number of GPIO in the array list could be 1 or 2.
      If only one gpio is specified, only one gpio used to control ENP/ENM.
      Else both are spefied, DSVP/DSVN could be controlled individually.
      Othersie, this property not specified. treat both as always-on regulator.
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this  imply it's optional.

If it's cannot be optional, you should use devm_gpiod_get_array() instead.

Regards,
Axel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ