Skip to contentSkip to conversation

fs/sysv: dereferencing ERR_PTR()

PATCH In review Dan Carpenter 2 participants 2 messages Apr 21, 2010 – Apr 22, 2010 Kernel janitors

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/sysv: dereferencing ERR_PTR()

I moved the dir_put_page() inside the if condition so we don't dereference "page", if it's an ERR_PTR().

fs/sysv/dir.c +1 -1
index 4e50286..1dabed2 100644
@@ -164,8 +164,8 @@ struct sysv_dir_entry *sysv_find_entry(struct dentry *dentry, struct page **res_
 							name, de->name))
 					goto found;
 			}
+			dir_put_page(page);
 		}
-		dir_put_page(page);
 
 		if (++n >= npages)
 			n = 0;