Re: [PATCH 3/7 v2] staging/ozwpan: Fix NULL vs zero in ozeltbuf.c(sparse warning)
From: Dan Carpenter
Date: Fri Feb 15 2013 - 09:52:48 EST
On Fri, Feb 15, 2013 at 03:22:24PM +0100, Peter Huewe wrote:
> This patch fixes the warning "Using plain integer as NULL pointer",
> generated by sparse, by replacing the offending 0s with NULL.
> If the initialization with NULL was unnecessary (due to unconditional
> assignment before first use) it was removed.
> Signed-off-by: Peter Huewe <peterhuewe@xxxxxx>
> @@ -151,7 +151,7 @@ int oz_elt_stream_create(struct oz_elt_buf *buf, u8 id, int max_buf_count)
> int oz_elt_stream_delete(struct oz_elt_buf *buf, u8 id)
> struct list_head *e;
> - struct oz_elt_stream *st;
> + struct oz_elt_stream *st = NULL;
> oz_trace("oz_elt_stream_delete(0x%x)\n", id);
> e = buf->stream_list.next;
You changed the code here. The original code would crash if
buf->stream_list was empty. I don't if that can happen, but I still
consider it a bug fix.
Good job, but next time you mention it in the changelog.
You've fixed a couple of these uninitialized variable bugs recently.
Is this is a clang warning? GCC doesn't catch it.
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/