diff mbox series

powerpc/xive: Add missing null check after calling kmalloc

Message ID 20211226135314.251221-1-ammar.faizi@intel.com (mailing list archive)
State Accepted
Headers show
Series powerpc/xive: Add missing null check after calling kmalloc | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_selftests warning Found 8 issues from 2 of 8 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu warning Found 12 issues from 3 of 24 jobs.
snowpatch_ozlabs/github-powerpc_clang warning Found 6 issues from 2 of 7 jobs.

Commit Message

Ammar Faizi Dec. 26, 2021, 1:54 p.m. UTC
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 <ammarfaizi2@gmail.com>
---
 arch/powerpc/sysdev/xive/spapr.c | 3 +++
 1 file changed, 3 insertions(+)

--
2.32.0

Comments

Cédric Le Goater Jan. 3, 2022, 6:41 a.m. UTC | #1
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 <ammarfaizi2@gmail.com>


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

Thanks,

C.
Michael Ellerman Jan. 10, 2022, 1:50 a.m. UTC | #2
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
diff mbox series

Patch

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);