public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* p used before making sure it is not NULL in kernel/auditsc.c
@ 2009-05-22  2:22 Zhenwen Xu
  2009-05-22  4:07 ` Al Viro
  0 siblings, 1 reply; 2+ messages in thread
From: Zhenwen Xu @ 2009-05-22  2:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: viro, eparis

p used before making sure it is not NULL in kernel/auditsc.c

here we should make sure the p is not NULL then use it.



Signed-off-by: Zhenwen Xu <helight.xu@gmail.com>
---
 kernel/auditsc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 7d6ac7c..876fdd1 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -341,13 +341,14 @@ static int put_tree_ref(struct audit_context *ctx, struct audit_chunk *chunk)
 {
 	struct audit_tree_refs *p = ctx->trees;
 	int left = ctx->tree_count;
+
+	if (!p)
+		return 0;
 	if (likely(left)) {
 		p->c[--left] = chunk;
 		ctx->tree_count = left;
 		return 1;
 	}
-	if (!p)
-		return 0;
 	p = p->next;
 	if (p) {
 		p->c[30] = chunk;
-- 
1.5.6.5

-- 
--------------------------------
http://zhwen.org - Open and Free

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

end of thread, other threads:[~2009-05-22  4:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-22  2:22 p used before making sure it is not NULL in kernel/auditsc.c Zhenwen Xu
2009-05-22  4:07 ` Al Viro

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