brcmfmac: add parameter check in brcmf_c_mkiovar()
authorArend van Spriel <arend@broadcom.com>
Thu, 13 Sep 2012 19:12:05 +0000 (21:12 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 24 Sep 2012 18:59:09 +0000 (14:59 -0400)
This patch assures data is only appended in output buffer when
data is not NULL and datalen is not zero.

Reviewed-by: Hante Meuleman <meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c

index f6b862d779867f211b997c9eee4c3f1cbeadc696..c45270a2a1d95ea0420b38ac3274a70c5a57c7c9 100644 (file)
@@ -80,8 +80,10 @@ brcmf_c_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen)
        strncpy(buf, name, buflen);
 
        /* append data onto the end of the name string */
-       memcpy(&buf[len], data, datalen);
-       len += datalen;
+       if (data && datalen) {
+               memcpy(&buf[len], data, datalen);
+               len += datalen;
+       }
 
        return len;
 }