Search Linux Wireless

Re: [patch 1/3] brcmfmac: cleanup casts in brcmf_c_mkiovar_bsscfg()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/03/2012 08:05 AM, Dan Carpenter wrote:
Remove some pointless casts from the return value of strlen().  The
"buflen" variable is already an unsigned int so it's never less than
zero and doesn't need to be casted to u32.

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

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
index 15c5db5..ae0978c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c
@@ -102,11 +102,11 @@ brcmf_c_mkiovar_bsscfg(char *name, char *data, uint datalen,

Internally we reworked this code and moved the function to another file. The casts are no longer there.

  	if (bssidx == 0)
  		return brcmf_c_mkiovar(name, data, datalen, buf, buflen);

-	prefixlen = (u32) strlen(prefix); /* lengh of bsscfg prefix */
-	namelen = (u32) strlen(name) + 1; /* lengh of iovar  name + null */
+	prefixlen = strlen(prefix); /* lengh of bsscfg prefix */
+	namelen = strlen(name) + 1; /* lengh of iovar name + null */
  	iolen = prefixlen + namelen + sizeof(bssidx_le) + datalen;

-	if (buflen < 0 || iolen > (u32)buflen) {
+	if (buflen < iolen) {

This is still wrong internally so we will fix this with the appropriate credits ;-)

  		brcmf_dbg(ERROR, "buffer is too short\n");
  		return 0;
  	}


Thanks.

Gr. AvS

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux