From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH] Usb: host - Fix possible NULL derefrence. Date: Mon, 30 Jan 2017 07:45:21 +0100 Message-ID: <20170130064521.GC4324@kroah.com> References: <1485752789-30374-1-git-send-email-shailendra.v@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1485752789-30374-1-git-send-email-shailendra.v-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Shailendra Verma Cc: Mathias Nyman , Stephen Warren , Thierry Reding , Alexandre Courbot , linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, p.shailesh-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, ashish.kalra-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org, Shailendra Verma List-Id: linux-tegra@vger.kernel.org On Mon, Jan 30, 2017 at 10:36:29AM +0530, Shailendra Verma wrote: > of_device_get_match_data could return NULL, and so can cause > a NULL pointer dereference later. > > Signed-off-by: Shailendra Verma > --- > drivers/usb/host/xhci-tegra.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c > index a59fafb..890c778 100644 > --- a/drivers/usb/host/xhci-tegra.c > +++ b/drivers/usb/host/xhci-tegra.c > @@ -903,6 +903,10 @@ static int tegra_xusb_probe(struct platform_device *pdev) > return -ENOMEM; > > tegra->soc = of_device_get_match_data(&pdev->dev); > + if (!tegra->soc) { How would the driver be loaded and the probe function called if this returns NULL? Is this ever possible? thanks, greg k-h