Skip to content

Commit ceffa63

Browse files
Chen Zhoumpe
authored andcommitted
powerpc/powernv: add NULL check after kzalloc
Fixes coccicheck warning: ./arch/powerpc/platforms/powernv/opal.c:813:1-5: alloc with no test, possible model on line 814 Add NULL check after kzalloc. Signed-off-by: Chen Zhou <chenzhou10@huawei.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200509020838.121660-1-chenzhou10@huawei.com
1 parent aa3bc36 commit ceffa63

File tree

1 file changed

+4
-0
lines changed
  • arch/powerpc/platforms/powernv

1 file changed

+4
-0
lines changed

arch/powerpc/platforms/powernv/opal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,10 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name,
811811
goto out;
812812

813813
attr = kzalloc(sizeof(*attr), GFP_KERNEL);
814+
if (!attr) {
815+
rc = -ENOMEM;
816+
goto out;
817+
}
814818
name = kstrdup(export_name, GFP_KERNEL);
815819
if (!name) {
816820
rc = -ENOMEM;

0 commit comments

Comments
 (0)