Staging: unisys: visornic_main: Replace kzalloc with kcalloc
PATCH 1/1 Staging: unisys: visornic_main: Replace kzalloc with kcalloc
Use kcalloc instead of kzalloc for allocation of array as it prevents integer overflow.
Semantic patch used:
@@
expression E1,E2,E3;
@@
- kzalloc(E1*sizeof(E2),E3)
+ kcalloc(E1,sizeof(E2),E3)
Signed-off-by Shivani Bhardwaj <[email protected]>
--- drivers/staging/unisys/visornic/visornic_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/unisys/visornic/visornic_main.c +2 -2
@@ -1797,8 +1797,8 @@ static int visornic_probe(struct visor_device *dev) goto cleanup_netdev; } - devdata->rcvbuf =kzalloc (sizeof (struct sk_buff *) * - devdata->num_rcv_bufs,GFP_KERNEL ); + devdata->rcvbuf =kcalloc (devdata->num_rcv_bufs, +sizeof (struct sk_buff *),GFP_KERNEL );if (!devdata->rcvbuf) { err = -ENOMEM ; goto cleanup_rcvbuf;
Signature · 1 line
2.1.0
Quoted 8 lines · Shivani Bhardwaj
Use kcalloc instead of kzalloc for allocation of array as it prevents integer overflow.
Semantic patch used:@@
expression E1,E2,E3;
@@
Quoted 7 lines
- kzalloc(E1*sizeof(E2),E3)
+ kcalloc(E1,sizeof(E2),E3)Signed-off-by Shivani Bhardwaj <[email protected]>---
drivers/staging/unisys/visornic/visornic_main.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)
Hello, this has already been done.I think you should update your staging-testing branch
Shraddha
Quoted 26 lines
drivers/staging/unisys/visornic/visornic_main.c +2
-2@@ -1797,8 +1797,8 @@ static int visornic_probe(struct visor_device *dev) goto cleanup_netdev; } - devdata->rcvbuf =kzalloc (sizeof (struct sk_buff *) * - devdata->num_rcv_bufs,GFP_KERNEL ); + devdata->rcvbuf =kcalloc (devdata->num_rcv_bufs, +sizeof (struct sk_buff *),GFP_KERNEL );if (!devdata->rcvbuf) { err = -ENOMEM ; goto cleanup_rcvbuf;Signature · 8 lines
2.1.0 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20151013154113.GA28785%40ubuntu. For more options, visit https://groups.google.com/d/optout.