[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_yxxoa12N9rNn2z@hovoldconsulting.com>
Date: Mon, 14 Apr 2025 08:57:10 +0200
From: Johan Hovold <johan@...nel.org>
To: Chenyuan Yang <chenyuan0y@...il.com>
Cc: vkoul@...nel.org, kishon@...nel.org, lumag@...nel.org,
quic_kriskura@...cinc.com, manivannan.sadhasivam@...aro.org,
konrad.dybcio@....qualcomm.com, quic_varada@...cinc.com,
quic_kbajaj@...cinc.com, johan+linaro@...nel.org,
linux-arm-msm@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] phy: qcom-qmp-usb: Fix an NULL vs IS_ERR() bug
On Sun, Apr 13, 2025 at 04:25:18PM -0500, Chenyuan Yang wrote:
> In qmp_usb_iomap(), one branch returns the result of devm_ioremap(), which
> can be NULL. Since IS_ERR() does not catch a NULL pointer,
> add an explicit NULL check in qmp_usb_parse_dt_legacy() to prevent
> potential dereference issues.
Good catch, but please move the handling of this into the
qmp_usb_iomap() helper so that it returns an error pointer also if
devm_ioremap() fails.
> Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
> Fixes: 2a55ec4f0a04 ("phy: qcom-qmp-usb: merge driver data")
This is not the commit that introduced the issue; this should be:
Fixes: a5d6b1ac56cb ("phy: qcom-qmp-usb: fix memleak on probe deferral")
> qmp->pcs = qmp_usb_iomap(dev, np, 2, exclusive);
> + if (!qmp->pcs)
> + return -ENOMEM;
> if (IS_ERR(qmp->pcs))
> return PTR_ERR(qmp->pcs);
Johan
Powered by blists - more mailing lists