From: Paul Zimmerman Date: Mon, 22 Apr 2013 21:00:16 +0000 (-0700) Subject: staging: dwc2: fix potential null pointer access X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=ddf58468e0e787b739a623594f52f9f43a188037;p=openwrt%2Fstaging%2Fblogic.git staging: dwc2: fix potential null pointer access We were testing hsotg pointer for null after we had already dereferenced it Reported-by: Fengguang Wu Signed-off-by: Paul Zimmerman Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/dwc2/hcd_ddma.c b/drivers/staging/dwc2/hcd_ddma.c index ab88f5069183..d2180b275f7a 100644 --- a/drivers/staging/dwc2/hcd_ddma.c +++ b/drivers/staging/dwc2/hcd_ddma.c @@ -217,18 +217,18 @@ static void dwc2_update_frame_list(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, struct dwc2_host_chan *chan; u16 i, j, inc; - if (!qh->channel) { - dev_err(hsotg->dev, "qh->channel = %p", qh->channel); + if (!hsotg) { + pr_err("hsotg = %p", hsotg); return; } - if (!hsotg) { - dev_err(hsotg->dev, "------hsotg = %p", hsotg); + if (!qh->channel) { + dev_err(hsotg->dev, "qh->channel = %p", qh->channel); return; } if (!hsotg->frame_list) { - dev_err(hsotg->dev, "-------hsotg->frame_list = %p", + dev_err(hsotg->dev, "hsotg->frame_list = %p", hsotg->frame_list); return; }