All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] libtracefs utest: Silence string-plus-int warnings
@ 2021-04-23  3:54 Ian Rogers
  2021-04-23  3:54 ` [PATCH 2/3] libtracefs utest: Fix a sometimes uninitialized variable Ian Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ian Rogers @ 2021-04-23  3:54 UTC (permalink / raw)
  To: linux-trace-devel, Tzvetomir Stoyanov, Steven Rostedt; +Cc: Ian Rogers

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);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-26 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/3] libtracefs utest: Silence string-plus-int warnings Tzvetomir Stoyanov
2021-04-26 15:16   ` Ian Rogers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.