p used before making sure it is not NULL in kernel/auditsc.c
From: Zhenwen Xu
Date: Thu May 21 2009 - 22:25:19 EST
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@xxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/