public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Zhenwen Xu <helight.xu@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, eparis@redhat.com
Subject: p used before making sure it is not NULL in kernel/auditsc.c
Date: Fri, 22 May 2009 10:22:41 +0800	[thread overview]
Message-ID: <20090522022241.GA3350@helight> (raw)

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

             reply	other threads:[~2009-05-22  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22  2:22 Zhenwen Xu [this message]
2009-05-22  4:07 ` p used before making sure it is not NULL in kernel/auditsc.c Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090522022241.GA3350@helight \
    --to=helight.xu@gmail.com \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox