kcalloc manages count*sizeof overflow.

Cc: Anton Vorontsov <[email protected]>
Cc: Colin Cross <[email protected]>
Signed-off-by: Fabian Frederick <[email protected]>
---
 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to