Skip to contentSkip to conversation

pstore/blk: Fix return value check in pstore_blk_init()

PATCH In review Pu Lehui 2 participants 2 messages Jun 17, 2021 Pstore filesystem

lore
Share & tools
lore

Pu Lehui

author
#0 lore raw

PATCH 1/1 pstore/blk: Fix return value check in pstore_blk_init()

Fix the return value check which testing the wrong variable in pstore_blk_init().

---
 fs/pstore/blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/blk.c +1 -1
index ccfb11ee4d50..d5e22e6209a6 100644
@@ -287,7 +287,7 @@ static int __init pstore_blk_init(void)
 		struct pstore_device_info *best_effort_dev;
 
 		best_effort_dev = kzalloc(sizeof(*best_effort_dev), GFP_KERNEL);
-		if (!best_effort) {
+		if (!best_effort_dev) {
 			ret = -ENOMEM;
 			goto unlock;
 		}
Signature · 1 line
2.17.1
#1 lore raw
Quoted 13 lines · Pu Lehui

Fix the return value check which testing the wrong variable in pstore_blk_init().

---
 fs/pstore/blk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pstore/blk.c +0 -0
index ccfb11ee4d50..d5e22e6209a6 100644

fs/pstore/blk.c static int __init pstore_blk_init(void) · line 293

Quoted 8 lines
fs/pstore/blk.c +1 -1
@@ -287,7 +287,7 @@ static int __init pstore_blk_init(void)
 		struct pstore_device_info *best_effort_dev;
 
 		best_effort_dev = kzalloc(sizeof(*best_effort_dev), GFP_KERNEL);
-		if (!best_effort) {
+		if (!best_effort_dev) {
 			ret = -ENOMEM;
 			goto unlock;
 		}

Whoops; thanks!

Signature · 1 line
Kees Cook