linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roi Martin <jroi.martin@gmail.com>
To: valdis.kletnieks@vt.edu
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, Roi Martin <jroi.martin@gmail.com>
Subject: [PATCH 6/6] staging: exfat: replace kmalloc with kmalloc_array
Date: Wed, 30 Oct 2019 02:03:28 +0100	[thread overview]
Message-ID: <20191030010328.10203-7-jroi.martin@gmail.com> (raw)
In-Reply-To: <20191030010328.10203-1-jroi.martin@gmail.com>

Replace expressions of the form:
	kmalloc(count * size, GFP_KERNEL);
With:
	kmalloc_array(count, size, GFP_KERNEL);

Signed-off-by: Roi Martin <jroi.martin@gmail.com>
---
 drivers/staging/exfat/exfat_core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/exfat/exfat_core.c b/drivers/staging/exfat/exfat_core.c
index f446e6e6c4ee..a9391f0b8141 100644
--- a/drivers/staging/exfat/exfat_core.c
+++ b/drivers/staging/exfat/exfat_core.c
@@ -713,8 +713,8 @@ static s32 __load_upcase_table(struct super_block *sb, sector_t sector,
 
 	u32 checksum = 0;
 
-	upcase_table = p_fs->vol_utbl = kmalloc(UTBL_COL_COUNT * sizeof(u16 *),
-						GFP_KERNEL);
+	upcase_table = kmalloc_array(UTBL_COL_COUNT, sizeof(u16 *), GFP_KERNEL);
+	p_fs->vol_utbl = upcase_table;
 	if (!upcase_table)
 		return FFS_MEMORYERR;
 	memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
@@ -793,8 +793,8 @@ static s32 __load_default_upcase_table(struct super_block *sb)
 	u16	uni = 0;
 	u16 **upcase_table;
 
-	upcase_table = p_fs->vol_utbl = kmalloc(UTBL_COL_COUNT * sizeof(u16 *),
-						GFP_KERNEL);
+	upcase_table = kmalloc_array(UTBL_COL_COUNT, sizeof(u16 *), GFP_KERNEL);
+	p_fs->vol_utbl = upcase_table;
 	if (!upcase_table)
 		return FFS_MEMORYERR;
 	memset(upcase_table, 0, UTBL_COL_COUNT * sizeof(u16 *));
-- 
2.20.1


  parent reply	other threads:[~2019-10-30  1:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30  1:03 [PATCH 0/6] staging: exfat: fix multiple coding-style issues Roi Martin
2019-10-30  1:03 ` [PATCH 1/6] staging: exfat: remove unnecessary parentheses Roi Martin
2019-10-30  1:03 ` [PATCH 2/6] staging: exfat: make alignment match open parenthesis Roi Martin
2019-10-30  1:03 ` [PATCH 3/6] staging: exfat: remove unnecessary new line in if condition Roi Martin
2019-10-30  1:03 ` [PATCH 4/6] staging: exfat: replace printk(KERN_INFO ...) with pr_info() Roi Martin
2019-10-30  1:03 ` [PATCH 5/6] staging: exfat: avoid multiple assignments Roi Martin
2019-10-30  1:03 ` Roi Martin [this message]
2019-10-30  9:42   ` [PATCH 6/6] staging: exfat: replace kmalloc with kmalloc_array Greg KH
2019-10-31 12:38     ` Roi Martin

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=20191030010328.10203-7-jroi.martin@gmail.com \
    --to=jroi.martin@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=valdis.kletnieks@vt.edu \
    /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).