linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com
Cc: Fabian Frederick <fabf@skynet.be>,
	Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 4/8] GFS2: replace count*size kzalloc by kcalloc
Date: Fri, 18 Jul 2014 11:37:41 +0100	[thread overview]
Message-ID: <1405679865-15728-5-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1405679865-15728-1-git-send-email-swhiteho@redhat.com>

From: Fabian Frederick <fabf@skynet.be>

kcalloc manages count*sizeof overflow.

Cc: cluster-devel@redhat.com
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
index 91f274d..4fafea1 100644
--- a/fs/gfs2/lock_dlm.c
+++ b/fs/gfs2/lock_dlm.c
@@ -1036,8 +1036,8 @@ static int set_recover_size(struct gfs2_sbd *sdp, struct dlm_slot *slots,
 
 	new_size = old_size + RECOVER_SIZE_INC;
 
-	submit = kzalloc(new_size * sizeof(uint32_t), GFP_NOFS);
-	result = kzalloc(new_size * sizeof(uint32_t), GFP_NOFS);
+	submit = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS);
+	result = kcalloc(new_size, sizeof(uint32_t), GFP_NOFS);
 	if (!submit || !result) {
 		kfree(submit);
 		kfree(result);
-- 
1.8.3.1


  parent reply	other threads:[~2014-07-18 10:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 10:37 GFS2: Pre-pull patch posting (fixes) Steven Whitehouse
2014-07-18 10:37 ` [PATCH 1/8] GFS2: Only wait for demote when last holder is dequeued Steven Whitehouse
2014-07-18 10:37 ` [PATCH 2/8] GFS2: Fix race in glock lru glock disposal Steven Whitehouse
2014-07-18 10:37 ` [PATCH 3/8] GFS2: Use GFP_NOFS when allocating glocks Steven Whitehouse
2014-07-18 10:37 ` Steven Whitehouse [this message]
2014-07-18 10:37 ` [PATCH 5/8] GFS2: Allow flocks to use normal glock dq rather than dq_wait Steven Whitehouse
2014-07-18 10:37 ` [PATCH 6/8] GFS2: Allow caching of glocks for flock Steven Whitehouse
2014-07-18 10:37 ` [PATCH 7/8] GFS2: memcontrol: Spelling s/invlidate/invalidate/ Steven Whitehouse
2014-07-18 10:37 ` [PATCH 8/8] GFS2: fs/gfs2/rgrp.c: kernel-doc warning fixes Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405679865-15728-5-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).