staging: brcm80211: simpler string handling in brcmf_c_pktfilter_offload_set()
authorRoland Vossen <rvossen@broadcom.com>
Tue, 5 Jul 2011 22:02:57 +0000 (00:02 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Jul 2011 02:47:51 +0000 (19:47 -0700)
Replaced two functions with strcpy().

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmfmac/dhd_common.c

index c37128d1d9700588ed5f17d3462b0baa54716bd6..fdec4683c422a1236b1e29c3ec48ba45df568ac6 100644 (file)
@@ -958,13 +958,7 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
                goto fail;
        }
 
-       memcpy(arg_save, arg, strlen(arg) + 1);
-
-       if (strlen(arg) > PKTFILTER_BUF_SIZE) {
-               BRCMF_ERROR(("Not enough buffer %d < %d\n", (int)strlen(arg),
-                            (int)sizeof(buf)));
-               goto fail;
-       }
+       strcpy(arg_save, arg);
 
        argv[i] = strsep(&arg_save, " ");
        while (argv[i++])
@@ -977,9 +971,8 @@ void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg)
        }
 
        str = "pkt_filter_add";
+       strcpy(buf, str);
        str_len = strlen(str);
-       strncpy(buf, str, str_len);
-       buf[str_len] = '\0';
        buf_len = str_len + 1;
 
        pkt_filterp = (struct brcmf_pkt_filter *) (buf + str_len + 1);