Commit fd380656 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Michael Ellerman

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarGreg Kurz <groug@kaod.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/cc53462734dfeaf15b6bad0e626b483de18656b4.1564647619.git.christophe.jaillet@wanadoo.fr
parent b214a8f2
...@@ -53,6 +53,10 @@ static int xive_irq_bitmap_add(int base, int count) ...@@ -53,6 +53,10 @@ static int xive_irq_bitmap_add(int base, int count)
xibm->base = base; xibm->base = base;
xibm->count = count; xibm->count = count;
xibm->bitmap = kzalloc(xibm->count, GFP_KERNEL); xibm->bitmap = kzalloc(xibm->count, GFP_KERNEL);
if (!xibm->bitmap) {
kfree(xibm);
return -ENOMEM;
}
list_add(&xibm->list, &xive_irq_bitmaps); list_add(&xibm->list, &xive_irq_bitmaps);
pr_info("Using IRQ range [%x-%x]", xibm->base, pr_info("Using IRQ range [%x-%x]", xibm->base,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment