lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 23 Jul 2018 21:30:25 +0300
From:   Ivan Bornyakov <brnkv.i1@...il.com>
To:     devel@...verdev.osuosl.org
Cc:     linux-kernel@...r.kernel.org, gregkh@...uxfoundation.org,
        benchan@...omium.org, jnjoseph@...gle.com, rspringer@...gle.com,
        Ivan Bornyakov <brnkv.i1@...il.com>
Subject: [PATCH v2] staging: gasket: use vzalloc instead of vmalloc/memset

Use vzalloc instead of vmalloc followed by memset with 0.

Signed-off-by: Ivan Bornyakov <brnkv.i1@...il.com>
---
 drivers/staging/gasket/gasket_page_table.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index 9f8116112e0a..3ffc8d67ec05 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -330,7 +330,7 @@ int gasket_page_table_init(
 	pg_tbl = *ppg_tbl;
 	bytes = total_entries * sizeof(struct gasket_page_table_entry);
 	if (bytes != 0) {
-		pg_tbl->entries = vmalloc(bytes);
+		pg_tbl->entries = vzalloc(bytes);
 		if (!pg_tbl->entries) {
 			gasket_nodev_error(
 				"No memory for address translation metadata.");
@@ -338,7 +338,6 @@ int gasket_page_table_init(
 			*ppg_tbl = NULL;
 			return -ENOMEM;
 		}
-		memset(pg_tbl->entries, 0, bytes);
 	}
 
 	mutex_init(&pg_tbl->mutex);
@@ -1067,13 +1066,12 @@ static int gasket_alloc_extended_subtable(
 
 	subtable_bytes = sizeof(struct gasket_page_table_entry) *
 		GASKET_PAGES_PER_SUBTABLE;
-	pte->sublevel = vmalloc(subtable_bytes);
+	pte->sublevel = vzalloc(subtable_bytes);
 	if (!pte->sublevel) {
 		free_page(page_addr);
 		memset(pte, 0, sizeof(struct gasket_page_table_entry));
 		return -ENOMEM;
 	}
-	memset(pte->sublevel, 0, subtable_bytes);
 
 	/* Map the page into DMA space. */
 	if (pg_tbl->dma_ops) {
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ