lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 23 Jun 2014 18:49:43 +0200
From:	Fabian Frederick <fabf@...net.be>
To:	linux-kernel@...r.kernel.org
Cc:	Fabian Frederick <fabf@...net.be>,
	Christine Caulfield <ccaulfie@...hat.com>,
	David Teigland <teigland@...hat.com>
Subject: [PATCH 1/1] FS/DLM:  replace count*size kzalloc by kcalloc

kcalloc manages count*sizeof overflow.

Cc: Christine Caulfield <ccaulfie@...hat.com>
Cc: David Teigland <teigland@...hat.com>
Signed-off-by: Fabian Frederick <fabf@...net.be>
---
 fs/dlm/lock.c   | 2 +-
 fs/dlm/member.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 83f3d55..3653dbe 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1427,7 +1427,7 @@ void dlm_scan_waiters(struct dlm_ls *ls)
 
 		if (!num_nodes) {
 			num_nodes = ls->ls_num_nodes;
-			warned = kzalloc(num_nodes * sizeof(int), GFP_KERNEL);
+			warned = kcalloc(num_nodes, sizeof(int), GFP_KERNEL);
 		}
 		if (!warned)
 			continue;
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
index 9c47f1c..aa57ac3 100644
--- a/fs/dlm/member.c
+++ b/fs/dlm/member.c
@@ -218,7 +218,7 @@ int dlm_slots_assign(struct dlm_ls *ls, int *num_slots, int *slots_size,
 
 	array_size = max + need;
 
-	array = kzalloc(array_size * sizeof(struct dlm_slot), GFP_NOFS);
+	array = kcalloc(array_size, sizeof(struct dlm_slot), GFP_NOFS);
 	if (!array)
 		return -ENOMEM;
 
@@ -493,7 +493,7 @@ void dlm_lsop_recover_done(struct dlm_ls *ls)
 
 	num = ls->ls_num_nodes;
 
-	slots = kzalloc(num * sizeof(struct dlm_slot), GFP_KERNEL);
+	slots = kcalloc(num, sizeof(struct dlm_slot), GFP_KERNEL);
 	if (!slots)
 		return;
 
-- 
1.8.4.5

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ