[lttng-dev] lttng lib: ring buffer

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Nov 30 08:16:19 EST 2011


Fixed by moving the check higher up, to lib_ring_buffer_open.

Thanks!

Mathieu

* Dan Carpenter (dan.carpenter at oracle.com) wrote:
> Hello Mathieu Desnoyers,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch c844b2f5cfea: "lttng lib: ring buffer" from Nov 28, 2011, 
> leads to the following Smatch complaint:
> 
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c +86 lib_ring_buffer_mmap_buf()
> 	 warn: variable dereferenced before check 'buf' (see line 79)
> 
> drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
>     78		unsigned long length = vma->vm_end - vma->vm_start;
>     79		struct channel *chan = buf->backend.chan;
>                                        ^^^^^^^^^^^^^^^^^
> Dereference.
> 
>     80		const struct lib_ring_buffer_config *config = chan->backend.config;
>     81		unsigned long mmap_buf_len;
>     82	
>     83		if (config->output != RING_BUFFER_MMAP)
>     84			return -EINVAL;
>     85	
>     86		if (!buf)
>                     ^^^^
> Check.
> 
>     87			return -EBADF;
>     88	
> 
> regards,
> dan carpenter
> 

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list