linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>
To: Ian Rogers <irogers@google.com>
Cc: Linux Trace Devel <linux-trace-devel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH 1/3] libtracefs utest: Silence string-plus-int warnings
Date: Mon, 26 Apr 2021 14:25:35 +0300	[thread overview]
Message-ID: <CAPpZLN4Ny2BkpfuBczA-Bs9-Nzf5md_CuqbEHgDYUD4pggtvjw@mail.gmail.com> (raw)
In-Reply-To: <20210423035438.2221760-1-irogers@google.com>

On Fri, Apr 23, 2021 at 6:54 AM Ian Rogers <irogers@google.com> wrote:
>
> Fix warnings of the form:
>
> utest/tracefs-utest.c:476:35: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
>         CU_TEST(strstr(kprobes, KPROBE_1 + 2) != NULL);
>         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
>

Hi Ian,
Thanks for testing and sending this patch. What
compiler/version/options you are using to get these warnings ?
The whole patchset looks good to me.

Acked-by: Tzvetomir Stoyanov <tz.stoyanov@gmail.com>



> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
>  utest/tracefs-utest.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
> index edb3a3d..c5efd5f 100644
> --- a/utest/tracefs-utest.c
> +++ b/utest/tracefs-utest.c
> @@ -453,21 +453,21 @@ static void test_instance_file(void)
>         CU_TEST(ret == strlen(KPROBE_1));
>         kprobes = tracefs_instance_file_read(NULL, KPROB_EVTS, &size);
>         CU_TEST(kprobes != NULL);
> -       CU_TEST(strstr(kprobes, KPROBE_1 + 2) != NULL);
> +       CU_TEST(strstr(kprobes, &KPROBE_1[2]) != NULL);
>         free(kprobes);
>
>         ret = tracefs_instance_file_append(NULL, KPROB_EVTS, KPROBE_2);
>         CU_TEST(ret == strlen(KPROBE_2));
>         kprobes = tracefs_instance_file_read(NULL, KPROB_EVTS, &size);
>         CU_TEST(kprobes != NULL);
> -       CU_TEST(strstr(kprobes, KPROBE_2 + 2) != NULL);
> +       CU_TEST(strstr(kprobes, &KPROBE_2[2]) != NULL);
>         free(kprobes);
>
>         ret = tracefs_instance_file_append(NULL, KPROB_EVTS, KPROBE_1_RM);
>         CU_TEST(ret == strlen(KPROBE_1_RM));
>         kprobes = tracefs_instance_file_read(NULL, KPROB_EVTS, &size);
>         CU_TEST(kprobes != NULL);
> -       CU_TEST(strstr(kprobes, KPROBE_1 + 2) == NULL);
> +       CU_TEST(strstr(kprobes, &KPROBE_1[2]) == NULL);
>         free(kprobes);
>
>         ret = tracefs_instance_file_clear(NULL, KPROB_EVTS);
> --
> 2.31.1.498.g6c1eba8ee3d-goog
>


--
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center

  parent reply	other threads:[~2021-04-26 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  3:54 [PATCH 1/3] libtracefs utest: Silence string-plus-int warnings Ian Rogers
2021-04-23  3:54 ` [PATCH 2/3] libtracefs utest: Fix a sometimes uninitialized variable Ian Rogers
2021-04-23  3:54 ` [PATCH 3/3] libtracefs utest: Make a null string fatal if it is passed to strstr Ian Rogers
2021-04-26 11:25 ` Tzvetomir Stoyanov [this message]
2021-04-26 15:16   ` [PATCH 1/3] libtracefs utest: Silence string-plus-int warnings 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=CAPpZLN4Ny2BkpfuBczA-Bs9-Nzf5md_CuqbEHgDYUD4pggtvjw@mail.gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=irogers@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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).