From: "Arend van Spriel" <arend@broadcom.com>
To: "Dan Carpenter" <dan.carpenter@oracle.com>
Cc: "Brett Rudley" <brudley@broadcom.com>,
"Roland Vossen" <rvossen@broadcom.com>,
"Franky (Zhenhui) Lin" <frankyl@broadcom.com>,
"Kan Yan" <kanyan@broadcom.com>,
"John W. Linville" <linville@tuxdriver.com>,
"Pieter-Paul Giesberts" <pieterpg@broadcom.com>,
"Alwin Beukers" <alwin@broadcom.com>,
linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com,
kernel-janitors@vger.kernel.org
Subject: Re: [patch 1/3] brcmfmac: cleanup casts in brcmf_c_mkiovar_bsscfg()
Date: Wed, 3 Oct 2012 09:07:27 +0200 [thread overview]
Message-ID: <506BE42F.4070203@broadcom.com> (raw)
In-Reply-To: <20121003060515.GA3802@elgon.mountain>
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@oracle.com>
>
> 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
prev parent reply other threads:[~2012-10-03 7:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-03 6:05 [patch 1/3] brcmfmac: cleanup casts in brcmf_c_mkiovar_bsscfg() Dan Carpenter
2012-10-03 7:07 ` Arend van Spriel [this message]
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=506BE42F.4070203@broadcom.com \
--to=arend@broadcom.com \
--cc=alwin@broadcom.com \
--cc=brcm80211-dev-list@broadcom.com \
--cc=brudley@broadcom.com \
--cc=dan.carpenter@oracle.com \
--cc=frankyl@broadcom.com \
--cc=kanyan@broadcom.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=pieterpg@broadcom.com \
--cc=rvossen@broadcom.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 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).