From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: jdike@addtoit.com, richard@nod.at,
anton.ivanov@cambridgegreys.com, rppt@linux.vnet.ibm.com,
akpm@linux-foundation.org, yuehaibing@huawei.com,
keescook@chromium.org
Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH 2/2] um: vector: Use 'kmalloc_array' instead of 'kmalloc'
Date: Wed, 26 Dec 2018 08:54:49 +0100 [thread overview]
Message-ID: <20181226075449.11071-1-christophe.jaillet@wanadoo.fr> (raw)
Use 'kmalloc_array' instead of 'kmalloc' when appropriate.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
I don't know why it has not already been replaced in 6da2ec56059c
("treewide: kmalloc() -> kmalloc_array()".
---
arch/um/drivers/vector_kern.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index 5b917716289d..dee5246bda81 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -507,12 +507,12 @@ static struct vector_queue *create_queue(
return NULL;
result->max_depth = max_size;
result->dev = vp->dev;
- result->mmsg_vector = kmalloc(
- (sizeof(struct mmsghdr) * max_size), GFP_KERNEL);
+ result->mmsg_vector = kmalloc_array(max_size, sizeof(struct mmsghdr),
+ GFP_KERNEL);
if (result->mmsg_vector == NULL)
goto out_mmsg_fail;
- result->skbuff_vector = kmalloc(
- (sizeof(void *) * max_size), GFP_KERNEL);
+ result->skbuff_vector = kmalloc_array(max_size, sizeof(void *),
+ GFP_KERNEL);
if (result->skbuff_vector == NULL)
goto out_skb_fail;
--
2.19.1
next reply other threads:[~2018-12-28 9:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-26 7:54 Christophe JAILLET [this message]
2019-01-02 16:34 ` [PATCH 2/2] um: vector: Use 'kmalloc_array' instead of 'kmalloc' Anton Ivanov
2019-01-08 23:58 ` Kees Cook
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=20181226075449.11071-1-christophe.jaillet@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=akpm@linux-foundation.org \
--cc=anton.ivanov@cambridgegreys.com \
--cc=jdike@addtoit.com \
--cc=keescook@chromium.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
--cc=rppt@linux.vnet.ibm.com \
--cc=yuehaibing@huawei.com \
/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).