From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f71.google.com (mail-pg0-f71.google.com [74.125.83.71]) by kanga.kvack.org (Postfix) with ESMTP id 16BA36B0009 for ; Wed, 14 Feb 2018 15:12:02 -0500 (EST) Received: by mail-pg0-f71.google.com with SMTP id w4so810906pgq.15 for ; Wed, 14 Feb 2018 12:12:02 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id a7-v6si3078997plz.18.2018.02.14.12.12.00 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Feb 2018 12:12:00 -0800 (PST) From: Matthew Wilcox Subject: [PATCH v2 3/8] Convert virtio_console to kvzalloc_struct Date: Wed, 14 Feb 2018 12:11:49 -0800 Message-Id: <20180214201154.10186-4-willy@infradead.org> In-Reply-To: <20180214201154.10186-1-willy@infradead.org> References: <20180214201154.10186-1-willy@infradead.org> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Matthew Wilcox , linux-mm@kvack.org, Kees Cook , linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, Joe Perches From: Matthew Wilcox Signed-off-by: Matthew Wilcox --- drivers/char/virtio_console.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 468f06134012..e0816cc2c6bd 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -433,8 +433,7 @@ static struct port_buffer *alloc_buf(struct virtqueue *vq, size_t buf_size, * Allocate buffer and the sg list. The sg list array is allocated * directly after the port_buffer struct. */ - buf = kmalloc(sizeof(*buf) + sizeof(struct scatterlist) * pages, - GFP_KERNEL); + buf = kvzalloc_struct(buf, sg, pages, GFP_KERNEL); if (!buf) goto fail; -- 2.15.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org