Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH 01/15] lttng lib: ring buffer: remove stale null-pointer
Date: Wed, 30 Nov 2011 13:34:14 -0500	[thread overview]
Message-ID: <1322678068-5255-2-git-send-email-mathieu.desnoyers@efficios.com> (raw)
In-Reply-To: <1322678068-5255-1-git-send-email-mathieu.desnoyers@efficios.com>

* Dan Carpenter <dan.carpenter at oracle.com> wrote:
[...]
> The patch c844b2f5cfea: "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: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
---
 .../lttng/lib/ringbuffer/ring_buffer_frontend.c    |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
index 802f5cd..957d7f3 100644
--- a/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
+++ b/drivers/staging/lttng/lib/ringbuffer/ring_buffer_frontend.c
@@ -1144,12 +1144,6 @@ void lib_ring_buffer_print_buffer_errors(struct lib_ring_buffer *buf,
 	unsigned long write_offset, cons_offset;
 
 	/*
-	 * Can be called in the error path of allocation when
-	 * trans_channel_data is not yet set.
-	 */
-	if (!chan)
-		return;
-	/*
 	 * No need to order commit_count, write_offset and cons_offset reads
 	 * because we execute at teardown when no more writer nor reader
 	 * references are left.
-- 
1.7.5.4




  reply	other threads:[~2011-11-30 18:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 18:34 [lttng-dev] LTTng wrapper cleanup Mathieu Desnoyers
2011-11-30 18:34 ` Mathieu Desnoyers [this message]
2011-11-30 18:34 ` [lttng-dev] [PATCH 02/15] lttng lib: ring buffer remove duplicate null pointer Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 03/15] lttng lib: ring buffer move null pointer check to open Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 04/15] Export vmalloc_sync_all symbol to GPL modules Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 05/15] lttng wrapper: add missing include to kallsyms wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 06/15] Remove LTTng vmalloc_sync_all wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 07/15] fs/splice: export splice_to_pipe to modules Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 08/15] lttng: remove splice_to_pipe wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 09/15] lttng: remove perf_event_create_kernel_counter wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 10/15] lttng: remove ftrace function tracer support (but keep Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 11/15] lttng: remove raw spinlock wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 12/15] lttng: remove uuid wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 13/15] Export task_prio to modules Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 14/15] lttng: remove task_prio wrapper Mathieu Desnoyers
2011-11-30 18:34 ` [lttng-dev] [PATCH 15/15] lttng: remove kallsyms wrapper Mathieu Desnoyers
2011-11-30 18:47 ` [lttng-dev] LTTng wrapper cleanup Greg KH
2011-11-30 19:13   ` Mathieu Desnoyers

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=1322678068-5255-2-git-send-email-mathieu.desnoyers@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    /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