Skip to content

Commit fd38065

Browse files
tititiou36mpe
authored andcommitted
powerpc/xive: Add a check for memory allocation failure
The result of this kzalloc is not checked. Add a check and corresponding error handling code. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/cc53462734dfeaf15b6bad0e626b483de18656b4.1564647619.git.christophe.jaillet@wanadoo.fr
1 parent b214a8f commit fd38065

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎arch/powerpc/sysdev/xive/spapr.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ static int xive_irq_bitmap_add(int base, int count)
5353
xibm->base = base;
5454
xibm->count = count;
5555
xibm->bitmap = kzalloc(xibm->count, GFP_KERNEL);
56+
if (!xibm->bitmap) {
57+
kfree(xibm);
58+
return -ENOMEM;
59+
}
5660
list_add(&xibm->list, &xive_irq_bitmaps);
5761

5862
pr_info("Using IRQ range [%x-%x]", xibm->base,

0 commit comments

Comments
 (0)