[PATCH 1/1] fs/pstore/ram.c: replace count*size kzalloc by kcalloc

From: Fabian Frederick
Date: Mon Jun 23 2014 - 12:47:14 EST


kcalloc manages count*sizeof overflow.

Cc: Anton Vorontsov <anton@xxxxxxxxxx>
Cc: Colin Cross <ccross@xxxxxxxxxxx>
Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
fs/pstore/ram.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 3b57443..87aa37c 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -347,8 +347,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
if (!cxt->max_dump_cnt)
return -ENOMEM;

- cxt->przs = kzalloc(sizeof(*cxt->przs) * cxt->max_dump_cnt,
- GFP_KERNEL);
+ cxt->przs = kcalloc(cxt->max_dump_cnt, sizeof(*cxt->przs), GFP_KERNEL);
if (!cxt->przs) {
dev_err(dev, "failed to initialize a prz array for dumps\n");
goto fail_prz;
--
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/