summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrishti Sharma <srishtishar@gmail.com>2017-09-14 15:48:13 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-09-18 13:00:07 +0300
commitaabdabad35d3c01f977084221afe09cab5dfa8af (patch)
tree74b6f10863153d0a9243cb9501b38795f3ac9434
parent2b8b4a2762f55627e96834776199eb8f078ae284 (diff)
downloadlinux-aabdabad35d3c01f977084221afe09cab5dfa8af.tar.xz
Staging: ccree: Use kcalloc instead of kzalloc
Use kcalloc instead of kzalloc to check for overflow before multiplication. Done using the following semantic patch by coccinelle. http://coccinelle.lip6.fr/rules/kzalloc.cocci Signed-off-by: Srishti Sharma <srishtishar@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/ccree/ssi_sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c
index 0655658bba4d..f7e0c5024a29 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -376,7 +376,7 @@ static int sys_init_dir(struct sys_dir *sys_dir, struct ssi_drvdata *drvdata,
return -ENOMEM;
/* allocate memory for directory's attributes list */
sys_dir->sys_dir_attr_list =
- kzalloc(sizeof(struct attribute *) * (num_of_attrs + 1),
+ kcalloc(num_of_attrs + 1, sizeof(struct attribute *),
GFP_KERNEL);
if (!(sys_dir->sys_dir_attr_list)) {