public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] fs/sysv: dereferencing ERR_PTR()
@ 2010-04-21 10:30 Dan Carpenter
  2010-04-22 10:29 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-04-21 10:30 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Al Viro, linux-kernel, kernel-janitors

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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] fs/sysv: dereferencing ERR_PTR()
  2010-04-21 10:30 [patch] fs/sysv: dereferencing ERR_PTR() Dan Carpenter
@ 2010-04-22 10:29 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2010-04-22 10:29 UTC (permalink / raw)
  To: Dan Carpenter, Christoph Hellwig, Al Viro, linux-kernel,
	kernel-janitors

On Wed, Apr 21, 2010 at 12:30:32PM +0200, Dan Carpenter wrote:
> 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>

Looks good,


Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-22 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-21 10:30 [patch] fs/sysv: dereferencing ERR_PTR() Dan Carpenter
2010-04-22 10:29 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox