From patchwork Wed Dec 26 07:54:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 1019130 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=wanadoo.fr Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QiH9IhPp"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43R2G43PP5z9s2P for ; Fri, 28 Dec 2018 20:58:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=cV9deZwXbVdgujPWpYpfibmdSl9FbLteqLwooIyvFrg=; b=QiH9IhPpTNMQbC 2PyTAgklInp9ikT7eRXTxpo0wt3EzBPLAS69Y5/ZNKkVCGN7vQK6FtnChlgc5SzfiJ2zR5AN2PdCD ifHTQeAz/lWT1NwWlylMfazulGn9Qmv2FGuz+2OZM7mf5qR2wpyZpAT8+3JP7xRvvRP9NFM78aGDa e7si05Me1CE4GJWjpzJVWYbfwG/YjATrXTbiqed0GRNZAkbRtc53CkcZgPGouHdDSBBGhrRSEkJOu hOBl0/7e0mjgMwaTPD7+qf0v2rHxoWGBMM+SHwAysRwlOaNeGA/seypRxugfeOkaJB4Dsx5ltYoez ggkDmQDbDoBXKDIZ5A5w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcou1-0001vE-9Q; Fri, 28 Dec 2018 09:58:01 +0000 Received: from smtp02.smtpout.orange.fr ([80.12.242.124] helo=smtp.smtpout.orange.fr) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcotx-0001ts-Ao for linux-um@lists.infradead.org; Fri, 28 Dec 2018 09:57:59 +0000 Received: from localhost.localdomain ([90.126.241.217]) by mwinf5d25 with ME id HMxn1z00A4i89ZE03MxnfN; Fri, 28 Dec 2018 10:57:48 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 28 Dec 2018 10:57:48 +0100 X-ME-IP: 90.126.241.217 From: Christophe JAILLET 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 Subject: [PATCH 2/2] um: vector: Use 'kmalloc_array' instead of 'kmalloc' Date: Wed, 26 Dec 2018 08:54:49 +0100 Message-Id: <20181226075449.11071-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181228_015757_723406_7E6A558D X-CRM114-Status: GOOD ( 13.97 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [80.12.242.124 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (christophe.jaillet[at]wanadoo.fr) X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-um@lists.infradead.org, linux-kernel@vger.kernel.org Sender: "linux-um" Errors-To: linux-um-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Use 'kmalloc_array' instead of 'kmalloc' when appropriate. Signed-off-by: Christophe JAILLET Acked-by: Anton Ivanov Reviewed-by: Kees Cook --- 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;