summaryrefslogtreecommitdiff
path: root/kernel/irq
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2024-08-28 15:22:19 +0800
committerThomas Gleixner <tglx@linutronix.de>2024-08-29 16:42:07 +0200
commitbf1e0fb69a15fac4d6ee71d0e1c715147add986a (patch)
treebba56179c0d70e3159d36d3927fc5dafb63744ed /kernel/irq
parenteb29369fa543e7d5557c19ebecf072244bb14815 (diff)
genirq/msi: Use kmemdup_array() instead of kmemdup()
Let kmemdup_array() take care about sizing instead of doing it open coded. Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240828072219.1249250-1-ruanjinjie@huawei.com
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/msi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 5fa0547ece0c..1c7e5159064c 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -82,7 +82,7 @@ static struct msi_desc *msi_alloc_desc(struct device *dev, int nvec,
desc->dev = dev;
desc->nvec_used = nvec;
if (affinity) {
- desc->affinity = kmemdup(affinity, nvec * sizeof(*desc->affinity), GFP_KERNEL);
+ desc->affinity = kmemdup_array(affinity, nvec, sizeof(*desc->affinity), GFP_KERNEL);
if (!desc->affinity) {
kfree(desc);
return NULL;