All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Franky Lin" <frankyl@broadcom.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	"Dan Carpenter" <dan.carpenter@oracle.com>
Subject: [PATCH 7/7] brcmfmac: fix end of loop check (signedness bug)
Date: Wed, 10 Oct 2012 11:13:12 -0700	[thread overview]
Message-ID: <1349892792-4792-8-git-send-email-frankyl@broadcom.com> (raw)
In-Reply-To: <1349892792-4792-1-git-send-email-frankyl@broadcom.com>

From: Dan Carpenter <dan.carpenter@oracle.com>

The problem here is that we loop until "remained_buf_len" is less than
zero, but since it is unsigned, it never is.

"remained_buf_len" has to be large enough to hold the value from
"mgmt_ie_buf_len".  That variable is type u32, but it only holds small
values so I have changed to both variables to int.

Also I removed the bogus initialization from "mgmt_ie_buf_len" so that
GCC can detect if it is used unitialized.  I moved the declaration of
"remained_buf_len" closer to where it is used so it's easier to read.

Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
---
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index 5e51f15..1c83612 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3972,7 +3972,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg,
 	u8  *iovar_ie_buf;
 	u8  *curr_ie_buf;
 	u8  *mgmt_ie_buf = NULL;
-	u32 mgmt_ie_buf_len;
+	int mgmt_ie_buf_len;
 	u32 *mgmt_ie_len;
 	u32 del_add_ie_buf_len = 0;
 	u32 total_ie_buf_len = 0;
@@ -3982,7 +3982,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg,
 	struct parsed_vndr_ie_info *vndrie_info;
 	s32 i;
 	u8 *ptr;
-	u32 remained_buf_len;
+	int remained_buf_len;
 
 	WL_TRACE("bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag);
 	iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
-- 
1.7.9.5



  parent reply	other threads:[~2012-10-10 18:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10 18:13 [PATCH 0/7] miscellaneous fixes intended for 3.7 Franky Lin
2012-10-10 18:13 ` [PATCH 1/7] brcmfmac: handle all exceptions as an error Franky Lin
2012-10-10 18:13 ` [PATCH 2/7] brcmfmac: Using zero instead of NULL Franky Lin
2012-10-10 18:13 ` [PATCH 3/7] brcmfmac: fix sparse warnings Franky Lin
2012-10-10 18:13 ` [PATCH 4/7] brcmfmac: use control channel in roamed status reporting Franky Lin
2012-10-10 18:13 ` [PATCH 5/7] brcmfmac: set dongle mode accordingly when interface up Franky Lin
2012-10-10 18:13 ` [PATCH 6/7] brcmfmac: remove 'always false' condition from brcmf_c_mkiovar_bsscfg Franky Lin
2012-10-10 18:13 ` Franky Lin [this message]
2012-10-15 18:27 ` [PATCH 0/7] miscellaneous fixes intended for 3.7 John W. Linville
2012-10-15 19:06   ` Franky Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349892792-4792-8-git-send-email-frankyl@broadcom.com \
    --to=frankyl@broadcom.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.