Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753608AbbKPTSp (ORCPT ); Mon, 16 Nov 2015 14:18:45 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:36411 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753502AbbKPTSl (ORCPT ); Mon, 16 Nov 2015 14:18:41 -0500 Subject: Re: [PATCH] usb: phy: msm: fix a possible NULL dereference To: Felipe Balbi References: <1447314323-30959-1-git-send-email-clabbe.montjoie@gmail.com> <87lh9xna93.fsf@saruman.tx.rr.com> Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org From: Corentin LABBE X-Enigmail-Draft-Status: N1110 Message-ID: <564A2C0E.70305@gmail.com> Date: Mon, 16 Nov 2015 20:18:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <87lh9xna93.fsf@saruman.tx.rr.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1483 Lines: 39 Le 16/11/2015 18:07, Felipe Balbi a ?crit : > > Hi, > > LABBE Corentin writes: >> of_match_device could return NULL, and so cause a NULL pointer >> dereference later. Renaming id to of_id (like all others do) in the >> process. >> >> Reported-by: coverity (CID 1324133) >> Signed-off-by: LABBE Corentin >> --- >> drivers/usb/phy/phy-msm-usb.c | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c >> index 80eb991..c4a66cf 100644 >> --- a/drivers/usb/phy/phy-msm-usb.c >> +++ b/drivers/usb/phy/phy-msm-usb.c >> @@ -1506,20 +1506,23 @@ static int msm_otg_read_dt(struct platform_device *pdev, struct msm_otg *motg) >> { >> struct msm_otg_platform_data *pdata; >> struct extcon_dev *ext_id, *ext_vbus; >> - const struct of_device_id *id; >> + const struct of_device_id *of_id; > > and why did you need to rename this variable ? Please resend without the > variable rename. > I was renaming because all other drivers call it of_id, but I got hint from another thread to use of_device_get_match_data() which will permit to remove that variable, and still solve the issue. Regards -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/