1. 01 Dec, 2011 2 commits
    • Mathieu Desnoyers's avatar
      lttng lib: ring buffer remove duplicate null pointer · e5f77873
      Mathieu Desnoyers authored
      * Dan Carpenter <dan.carpenter@oracle.com> wrote:
      > The patch c844b2f5: "lttng lib: ring buffer" from Nov 28, 2011,
      > leads to the following Smatch complaint:
      >
      > drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c +33
      > +lib_ring_buffer_fault()
      >          warn: variable dereferenced before check 'buf' (see line 26)
      >
      > drivers/staging/lttng/lib/ringbuffer/ring_buffer_mmap.c
      >     25          struct lib_ring_buffer *buf = vma->vm_private_data;
      >     26          struct channel *chan = buf->backend.chan;
      >                                        ^^^^^^^^^^^^^^^^^
      > Dereference.
      >
      >     27          const struct lib_ring_buffer_config *config = chan->backend.config;
      >     28          pgoff_t pgoff = vmf->pgoff;
      >     29          struct page **page;
      >     30          void **virt;
      >     31          unsigned long offset, sb_bindex;
      >     32
      >     33          if (!buf)
      >                     ^^^^
      > Check.
      >
      >     34                  return VM_FAULT_OOM;
      >     35
      
      This check is performed at mapping setup time in
      lib_ring_buffer_mmap_buf() already, so we can safely remove this
      duplicata.
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e5f77873
    • Mathieu Desnoyers's avatar
      lttng lib: ring buffer: remove stale null-pointer · 2f8e0b31
      Mathieu Desnoyers authored
      * Dan Carpenter <dan.carpenter@oracle.com> wrote:
      [...]
      > The patch c844b2f5: "lttng lib: ring buffer" from Nov 28, 2011,
      > leads to the following Smatch complaint:
      >
      > drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c +1150
      > +lib_ring_buffer_print_buffer_errors()
      >          warn: variable dereferenced before check 'chan' (see line 1143)
      >
      > drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
      >   1142  {
      >   1143          const struct lib_ring_buffer_config *config =
      > +chan->backend.config;
      >
      > +^^^^^^^^^^^^^^^^^^^^
      > Dereference.
      >
      >   1144          unsigned long write_offset, cons_offset;
      >   1145
      >   1146          /*
      >   1147           * Can be called in the error path of allocation when
      >   1148           * trans_channel_data is not yet set.
      >   1149           */
      >   1150          if (!chan)
      >                 ^^^^^^^^^
      > Check.  At first glance the comment seems out of date, I think check can
      > be removed safely.
      >
      >   1151                  return;
      >   1152          /*
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2f8e0b31
  2. 30 Nov, 2011 38 commits