projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a9d1343
)
LoongArch: Check the return value when creating kobj
author
Tao Cui
<cuitao@kylinos.cn>
Thu, 18 Sep 2025 11:44:04 +0000
(19:44 +0800)
committer
Huacai Chen
<chenhuacai@loongson.cn>
Thu, 18 Sep 2025 11:44:04 +0000
(19:44 +0800)
Add a check for the return value of kobject_create_and_add(), to ensure
that the kobj allocation succeeds for later use.
Cc: stable@vger.kernel.org
Signed-off-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kernel/env.c
patch
|
blob
|
history
diff --git
a/arch/loongarch/kernel/env.c
b/arch/loongarch/kernel/env.c
index
c0a5dc9
..
be309a7
100644
(file)
--- a/
arch/loongarch/kernel/env.c
+++ b/
arch/loongarch/kernel/env.c
@@
-109,6
+109,8
@@
static int __init boardinfo_init(void)
struct kobject *loongson_kobj;
loongson_kobj = kobject_create_and_add("loongson", firmware_kobj);
+ if (!loongson_kobj)
+ return -ENOMEM;
return sysfs_create_file(loongson_kobj, &boardinfo_attr.attr);
}