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:   Sun, 12 Dec 2021 17:31:35 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Miaoqian Lin <linmq006@...il.com>
Cc:     JC Kuo <jckuo@...dia.com>, Kishon Vijay Abraham I <kishon@...com>,
        Vinod Koul <vkoul@...nel.org>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        linux-phy@...ts.infradead.org, linux-tegra@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] phy: tegra: xusb: Fix NULL vs IS_ERR_OR_NULL checking

12.12.2021 09:50, Miaoqian Lin пишет:
> The tegra_xusb_find_port_node() function may return error pointer when
> kasprintf() return NULL. Using IS_ERR_OR_NULL to check the return value
> of tegra_xusb_find_port_node() to catch this.
> 
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
>  drivers/phy/tegra/xusb.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Instead of changing the 6 lines and making code less readable, you could
change a single line.

diff --git a/drivers/phy/tegra/xusb.c b/drivers/phy/tegra/xusb.c
index 963de5913e50..aa5237eacd29 100644
--- a/drivers/phy/tegra/xusb.c
+++ b/drivers/phy/tegra/xusb.c
@@ -455,7 +455,7 @@ tegra_xusb_find_port_node(struct tegra_xusb_padctl
*padctl, const char *type,
        name = kasprintf(GFP_KERNEL, "%s-%u", type, index);
        if (!name) {
                of_node_put(ports);
-               return ERR_PTR(-ENOMEM);
+               return NULL;
        }
        np = of_get_child_by_name(ports, name);
        kfree(name);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ