summaryrefslogtreecommitdiff
path: root/drivers/staging/wlan-ng/prism2fw.c
diff options
context:
space:
mode:
authorSergio Paracuellos <sergio.paracuellos@gmail.com>2016-10-09 17:29:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-16 10:25:45 +0200
commitcfea8abf67e57dbe430338895fbb127374672da1 (patch)
tree78c94fa696e5855c4be6e284b84cc564c3a9a01a /drivers/staging/wlan-ng/prism2fw.c
parent173bf7e37f71173f1645161ee849dfdc3d577300 (diff)
staging: wlan-ng: get memory from kernel allocators instead of big static buffer
This patch fix the following sparse warnings in prism2fw.c: warning: memset with byte count of 120000 Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wlan-ng/prism2fw.c')
-rw-r--r--drivers/staging/wlan-ng/prism2fw.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index 2454a787b177..d90b1f47a558 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -124,7 +124,7 @@ struct imgchunk {
/* Data records */
static unsigned int ns3data;
-static struct s3datarec s3data[S3DATA_MAX];
+static struct s3datarec *s3data;
/* Plug records */
static unsigned int ns3plug;
@@ -250,7 +250,12 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr,
/* Initialize the data structures */
ns3data = 0;
- memset(s3data, 0, sizeof(s3data));
+ s3data = kcalloc(S3DATA_MAX, sizeof(*s3data), GFP_KERNEL);
+ if (!s3data) {
+ result = -ENOMEM;
+ goto out;
+ }
+
ns3plug = 0;
memset(s3plug, 0, sizeof(s3plug));
ns3crc = 0;
@@ -480,7 +485,7 @@ static void free_chunks(struct imgchunk *fchunk, unsigned int *nfchunks)
static void free_srecs(void)
{
ns3data = 0;
- memset(s3data, 0, sizeof(s3data));
+ kfree(s3data);
ns3plug = 0;
memset(s3plug, 0, sizeof(s3plug));
ns3crc = 0;