[patch] fs/sysv: dereferencing ERR_PTR()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dan Carpenter
Date: Wednesday, April 21, 2010 - 3:30 am

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

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c
index 4e50286..1dabed2 100644
--- a/fs/sysv/dir.c
+++ b/fs/sysv/dir.c
@@ -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;
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch] fs/sysv: dereferencing ERR_PTR(), Dan Carpenter, (Wed Apr 21, 3:30 am)
Re: [patch] fs/sysv: dereferencing ERR_PTR(), Christoph Hellwig, (Thu Apr 22, 3:29 am)