summaryrefslogtreecommitdiff
path: root/drivers/staging/fsl_dpa_offload
diff options
context:
space:
mode:
authorMarian Chereji <marian.chereji@freescale.com>2014-09-16 09:27:35 (GMT)
committerMatthew Weigel <Matthew.Weigel@freescale.com>2014-12-11 18:39:38 (GMT)
commit09fca01720732b53d36c80c504f10b703c4728ab (patch)
tree521d2eb00bbefb58c03b34f199e57976b74a96b9 /drivers/staging/fsl_dpa_offload
parent491a6871fccad3c4b05be4c57d7ac69de266e2d1 (diff)
downloadlinux-fsl-qoriq-09fca01720732b53d36c80c504f10b703c4728ab.tar.xz
dpa_offload: Fix bad allocation size for pointer array
In the DPA statistics wrapper, in function "do_ioctl_stats_create_class_counter" the following pointers were allocated using a bad size (because of an additional '*' added by mistake to the "sizeof" operator argument): tbl->keys cnode->keys The size for these arrays of pointers should be (NUM x sizeof(struct dpa_offload_lookup_key *)) instead of (NUM x sizeof(struct dpa_offload_lookup_key)). tbl->pairs The correct size of this array should be (NUM x sizeof(struct dpa_offload_lookup_key_pair *)) instead of (NUM x sizeof(struct dpa_offload_lookup_key_pair)). Change-Id: I190d76973107300171e6f3033d8a79a3482fdd73 Signed-off-by: Marian Chereji <marian.chereji@freescale.com> Reviewed-on: http://git.am.freescale.net:8181/18811 Reviewed-by: Anca Jeanina Floarea <anca.floarea@freescale.com>
Diffstat (limited to 'drivers/staging/fsl_dpa_offload')
-rw-r--r--drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c
index 90d988c..aa30e0e 100644
--- a/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c
+++ b/drivers/staging/fsl_dpa_offload/wrp_dpa_stats.c
@@ -925,7 +925,7 @@ static int do_ioctl_stats_create_class_counter(void *args)
/* Override user-space pointers with kernel memory */
tbl->keys = kzalloc(cls_mbrs *
- sizeof(**tbl->keys), GFP_KERNEL);
+ sizeof(*tbl->keys), GFP_KERNEL);
if (!tbl->keys) {
log_err("Cannot allocate kernel memory for lookup keys array\n");
return -ENOMEM;
@@ -947,7 +947,7 @@ static int do_ioctl_stats_create_class_counter(void *args)
/* Override user-space pointers with kernel memory */
tbl->pairs = kzalloc(cls_mbrs *
- sizeof(**tbl->pairs), GFP_KERNEL);
+ sizeof(*tbl->pairs), GFP_KERNEL);
if (!tbl->pairs) {
log_err("Cannot allocate kernel memory for lookup pairs array\n");
return -ENOMEM;
@@ -977,7 +977,7 @@ static int do_ioctl_stats_create_class_counter(void *args)
/* Override user-space pointers with kernel memory */
cnode->keys = kzalloc(cls_mbrs *
- sizeof(**cnode->keys), GFP_KERNEL);
+ sizeof(*cnode->keys), GFP_KERNEL);
if (!cnode->keys) {
log_err("No more memory to store array of keys\n");
return -ENOMEM;