Skip to contentSkip to conversation

ubifs: fix an IS_ERR() vs NULL check

PATCH New Dan Carpenter 1 participant 1 message Jun 3, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubifs: fix an IS_ERR() vs NULL check

The ubifs_fast_find_frdi_idx() function returns NULL on error, it doesn't return error pointers. Update the check accordingly.

Fixes 1e51764a3c2a ("UBIFS: add new flash file system")
---
 fs/ubifs/gc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ubifs/gc.c +2 -2
index dc3e26e9ed7b..7cc22d7317ea 100644
@@ -895,8 +895,8 @@ int ubifs_gc_start_commit(struct ubifs_info *c)
 	/* Record index freeable LEBs for unmapping after commit */
 	while (1) {
 		lp = ubifs_fast_find_frdi_idx(c);
-		if (IS_ERR(lp)) {
-			err = PTR_ERR(lp);
+		if (!lp) {
+			err = -ENOMEM;
 			goto out;
 		}
 		if (!lp)
Signature · 1 line
2.30.2