Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753447AbbKPTXJ (ORCPT ); Mon, 16 Nov 2015 14:23:09 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:41068 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751946AbbKPTXH (ORCPT ); Mon, 16 Nov 2015 14:23:07 -0500 From: Felipe Balbi To: Corentin LABBE CC: , , Subject: Re: [PATCH] usb: phy: msm: fix a possible NULL dereference In-Reply-To: <564A2C0E.70305@gmail.com> References: <1447314323-30959-1-git-send-email-clabbe.montjoie@gmail.com> <87lh9xna93.fsf@saruman.tx.rr.com> <564A2C0E.70305@gmail.com> User-Agent: Notmuch/0.21 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Mon, 16 Nov 2015 13:23:01 -0600 Message-ID: <87mvudlpey.fsf@saruman.tx.rr.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2967 Lines: 81 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, (you need to break your lines at 80 characters) Corentin LABBE writes: > Le 16/11/2015 18:07, Felipe Balbi a =C3=A9crit : >>=20 >> Hi, >>=20 >> 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-us= b.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_devi= ce *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; >>=20 >> and why did you need to rename this variable ? Please resend without the >> variable rename. >>=20 > > 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. for -rc we usually want the smallest patch needed to fix the issue. That would be the two line if() condition. If converting to of_device_get_match_data() is about the same (2 or 3 lines), then it should be fine; but as a general rule of thumb: we don't fix and cleanup/refactor on the same patch unless strictly necessary. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWSi0WAAoJEIaOsuA1yqREpuYP/1smzqTDv+YtOcAg7hp+ay4v uu1SDGBDpa6BgSu/2HWDSmOVNoeMDAwj306yUfke7KZ5VRCSORs8ogQ6uLYFgkff 8IJKCSHY/5RkfXgw+m/6BPYA3lQAYYoVbMH52MfRj/Kh22VFL4xVBQCNs3Uq5XiX vLNDHp8dyQUD1Pzug/oUXudVMkc0ijC9SNDh92XsqecRQSyvfAeDIp0PK6PlNjNr oa1J0kQraMyQQXhHZ34lFDG/bDANkHe5KsID19vN6mb5C+5+AH9WJdyKM74B5T9K TogQoCKMQqK2Xz1uK3wwolFQA5i+IDpLmSlDnQ6G5yp5EhoaKtCw/PCpdczpF13r g6amzAt/ymEDiSMtFuTrhKUIWQCeDq15LfB52CfYnt6qHhosn79gFXy5f0qY9QBF jFrA+uoJDznrGL/prrRmO9awkhi4NKhpvGG6xy1QM0JxC101HXPUDl+sDkv31J7A hqaU1dsWUONAx1xgUMHF8ZgJ3n0jNCtzrb53TwgDpA1aXZHljrbmT3CEjyYWc2CI NPwQ+NFoEmXsv2gVyK39ckleDpbcAVT8YHEVfOFPAk3G2SAu7tOCHwY5tf3J9H+v ljBtx37+YO7JqsRFnozr0jP5E8ZtuaaaXFtmedcEfB1HDbc9E9ZKNu/dfXYNqnca V0FAGhtK485JobctLxrC =2dOI -----END PGP SIGNATURE----- --=-=-=-- -- 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/