linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] brcm80211: fmac: fix a couple checking after dereference bugs
@ 2012-02-24  6:22 Dan Carpenter
  2012-02-24 11:15 ` Arend van Spriel
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-02-24  6:22 UTC (permalink / raw)
  To: Brett Rudley
  Cc: Roland Vossen, Arend van Spriel, Franky (Zhenhui) Lin, Kan Yan,
	John W. Linville, Pieter-Paul Giesberts, linux-wireless,
	kernel-janitors

There were two dereferencing before checking for NULL static checker
complaints in this new file.  The list cursor is never NULL so that
check can be removed.  I moved the other dereference after the check.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index 934ed78..7c54d1d 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -482,7 +482,7 @@ static void brcmf_usb_free_q(struct list_head *q, bool pending)
 	struct brcmf_usbreq *req, *next;
 	int i = 0;
 	list_for_each_entry_safe(req, next, q, list) {
-		if (!req || !req->urb) {
+		if (!req->urb) {
 			brcmf_dbg(ERROR, "bad req\n");
 			break;
 		}
@@ -712,12 +712,12 @@ static int brcmf_usb_up(struct device *dev)
 	struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev);
 	u16 ifnum;
 
-	if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP)
-		return 0;
-
 	if (devinfo == NULL)
 		return -EINVAL;
 
+	if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP)
+		return 0;
+
 	/* If the USB/HSIC bus in sleep state, wake it up */
 	if (devinfo->suspend_state == USBOS_SUSPEND_STATE_SUSPENDED) {
 		if (brcmf_usb_pnp(devinfo, BCMFMAC_USB_PNP_RESUME) != 0) {

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] brcm80211: fmac: fix a couple checking after dereference bugs
  2012-02-24  6:22 [patch] brcm80211: fmac: fix a couple checking after dereference bugs Dan Carpenter
@ 2012-02-24 11:15 ` Arend van Spriel
  0 siblings, 0 replies; 2+ messages in thread
From: Arend van Spriel @ 2012-02-24 11:15 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Brett Rudley, Roland Vossen, Franky (Zhenhui) Lin, Kan Yan,
	John W. Linville, Pieter-Paul Giesberts,
	linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org

On 02/24/2012 07:22 AM, Dan Carpenter wrote:
> There were two dereferencing before checking for NULL static checker
> complaints in this new file.  The list cursor is never NULL so that
> check can be removed.  I moved the other dereference after the check.
>
> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>

Acked-by: Arend van Spriel <arend@broadcom.com>

Gr. AvS



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-24 11:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-24  6:22 [patch] brcm80211: fmac: fix a couple checking after dereference bugs Dan Carpenter
2012-02-24 11:15 ` Arend van Spriel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).