lkml.org 
[lkml]   [2014]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/1] fs/pstore/ram.c: replace count*size kzalloc by kcalloc
Date
kcalloc manages count*sizeof overflow.

Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
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


\
 
 \ /
  Last update: 2014-06-23 20:21    [W:0.020 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site