[PATCH] powerpc/xive: Add missing null check after calling kmalloc

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE1674d LANDED

Landed in mainline as 18dbfcdedc80 on 2022-01-04.

3 messages, 3 authors, 2022-01-10 · open the first message on its own page

[PATCH] powerpc/xive: Add missing null check after calling kmalloc

From: Ammar Faizi <hidden>
Date: 2021-12-26 14:01:44

Commit 930914b7d528fc ("powerpc/xive: Add a debugfs file to dump
internal XIVE state") forgot to add a null check.

Add it.

Cc: Cédric Le Goater <clg@kaod.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Fixes: 930914b7d528fc6b0249bffc00564100bcf6ef75 ("powerpc/xive: Add a debugfs file to dump internal XIVE state")
Signed-off-by: Ammar Faizi <redacted>
---
 arch/powerpc/sysdev/xive/spapr.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c
index f143b6f111ac..1179632560b8 100644
--- a/arch/powerpc/sysdev/xive/spapr.c
+++ b/arch/powerpc/sysdev/xive/spapr.c
@@ -653,6 +653,9 @@ static int xive_spapr_debug_show(struct seq_file *m, void *private)
 	struct xive_irq_bitmap *xibm;
 	char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);

+	if (!buf)
+		return -ENOMEM;
+
 	list_for_each_entry(xibm, &xive_irq_bitmaps, list) {
 		memset(buf, 0, PAGE_SIZE);
 		bitmap_print_to_pagebuf(true, buf, xibm->bitmap, xibm->count);
--
2.32.0

Re: [PATCH] powerpc/xive: Add missing null check after calling kmalloc

From: Cédric Le Goater <clg@kaod.org>
Date: 2022-01-03 06:48:11

On 12/26/21 14:54, Ammar Faizi wrote:
Commit 930914b7d528fc ("powerpc/xive: Add a debugfs file to dump
internal XIVE state") forgot to add a null check.

Add it.

Cc: Cédric Le Goater <clg@kaod.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Fixes: 930914b7d528fc6b0249bffc00564100bcf6ef75 ("powerpc/xive: Add a debugfs file to dump internal XIVE state")
Signed-off-by: Ammar Faizi <redacted>

Reviewed-by: Cédric Le Goater <clg@kaod.org>

Thanks,

C.

Re: [PATCH] powerpc/xive: Add missing null check after calling kmalloc

From: Michael Ellerman <hidden>
Date: 2022-01-10 01:56:14

On Sun, 26 Dec 2021 20:54:02 +0700, Ammar Faizi wrote:
Commit 930914b7d528fc ("powerpc/xive: Add a debugfs file to dump
internal XIVE state") forgot to add a null check.

Add it.
Applied to powerpc/next.

[1/1] powerpc/xive: Add missing null check after calling kmalloc
      https://git.kernel.org/powerpc/c/18dbfcdedc802f9500b2c29794f22a31d27639c0

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help