linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: linux-trace-devel@vger.kernel.org,
	Tzvetomir Stoyanov <tz.stoyanov@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Ian Rogers <irogers@google.com>
Subject: [PATCH v1 2/2] libtracefs: Fix compiler -Wmemsize-comparison warning
Date: Thu, 15 Dec 2022 10:31:51 -0800	[thread overview]
Message-ID: <20221215183151.2685460-2-irogers@google.com> (raw)
In-Reply-To: <20221215183151.2685460-1-irogers@google.com>

Fixes the following clang warning:

utest/tracefs-utest.c:828:75: error: size argument in 'strncmp' call is a comparison [-Werror,-Wmemsize-comparison]
            (!save_debug || strncmp(save_debug, save_tracing, strlen(save_debug) != 0)))
                                                              ~~~~~~~~~~~~~~~~~~~^~~~
utest/tracefs-utest.c:828:22: note: did you mean to compare the result of 'strncmp' instead?
            (!save_debug || strncmp(save_debug, save_tracing, strlen(save_debug) != 0)))
                            ^                                                        ~
                                                                                )
utest/tracefs-utest.c:828:56: note: explicitly cast the argument to size_t to silence this warning
            (!save_debug || strncmp(save_debug, save_tracing, strlen(save_debug) != 0)))
                                                              ^
                                                              (size_t)(              )

Signed-off-by: Ian Rogers <irogers@google.com>
---
 utest/tracefs-utest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 629cf2b..e0e3c07 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -825,7 +825,7 @@ static void test_mounting(void)
 		mount("debugfs", save_debug, "debugfs", 0, NULL);
 
 	if (save_tracing &&
-	    (!save_debug || strncmp(save_debug, save_tracing, strlen(save_debug) != 0)))
+	    (!save_debug || strncmp(save_debug, save_tracing, strlen(save_debug)) != 0))
 		mount("tracefs", save_tracing, "tracefs", 0, NULL);
 
 	free(save_debug);
-- 
2.39.0.314.g84b9a713c41-goog


  reply	other threads:[~2022-12-15 18:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 18:31 [PATCH v1 1/2] libtracefs: Move initialization below a null test Ian Rogers
2022-12-15 18:31 ` Ian Rogers [this message]
2022-12-15 19:03   ` [PATCH v1 2/2] libtracefs: Fix compiler -Wmemsize-comparison warning Steven Rostedt
2022-12-15 19:02 ` [PATCH v1 1/2] libtracefs: Move initialization below a null test Steven Rostedt
2022-12-15 20:13   ` Ian Rogers

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=20221215183151.2685460-2-irogers@google.com \
    --to=irogers@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tz.stoyanov@gmail.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;
as well as URLs for NNTP newsgroup(s).