[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250426061130.work.001-kees@kernel.org>
Date: Fri, 25 Apr 2025 23:11:31 -0700
From: Kees Cook <kees@...nel.org>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Kees Cook <kees@...nel.org>,
Kristen Accardi <kristen.c.accardi@...el.com>,
Vinicius Costa Gomes <vinicius.gomes@...el.com>,
"David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: [PATCH] crypto: iaa: Adjust workqueue allocation type
In preparation for making the kmalloc family of allocators type aware,
we need to make sure that the returned type from the allocation matches
the type of the variable being assigned. (Before, the allocator would
always return "void *", which can be implicitly cast to any pointer type.)
The assigned type is "struct idxd_wq **", but the returned type will be
"struct wq **". These are the same size allocation (pointer sized), but
the types don't match. Adjust the allocation type to match the assignment.
Signed-off-by: Kees Cook <kees@...nel.org>
---
Cc: Kristen Accardi <kristen.c.accardi@...el.com>
Cc: Vinicius Costa Gomes <vinicius.gomes@...el.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: <linux-crypto@...r.kernel.org>
---
drivers/crypto/intel/iaa/iaa_crypto_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/intel/iaa/iaa_crypto_main.c
index 09d9589f2d68..4aa503d6b15c 100644
--- a/drivers/crypto/intel/iaa/iaa_crypto_main.c
+++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c
@@ -725,7 +725,7 @@ static int alloc_wq_table(int max_wqs)
for (cpu = 0; cpu < nr_cpus; cpu++) {
entry = per_cpu_ptr(wq_table, cpu);
- entry->wqs = kcalloc(max_wqs, sizeof(struct wq *), GFP_KERNEL);
+ entry->wqs = kcalloc(max_wqs, sizeof(*entry->wqs), GFP_KERNEL);
if (!entry->wqs) {
free_wq_table();
return -ENOMEM;
--
2.34.1
Powered by blists - more mailing lists