Skip to content

Commit d2c7350

Browse files
captain5050acmel
authored andcommitted
perf bench: Fix 2 memory sanitizer warnings
Memory sanitizer warns if a write is performed where the memory being read for the write is uninitialized. Avoid this warning by initializing the memory. Signed-off-by: Ian Rogers <irogers@google.com> Acked-by: Jiri Olsa <jolsa@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20200912053725.1405857-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 8a39e8c commit d2c7350

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/perf/bench/sched-messaging.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@ static void fdpair(int fds[2])
6666
/* Block until we're ready to go */
6767
static void ready(int ready_out, int wakefd)
6868
{
69-
char dummy;
7069
struct pollfd pollfd = { .fd = wakefd, .events = POLLIN };
7170

7271
/* Tell them we're ready. */
73-
if (write(ready_out, &dummy, 1) != 1)
72+
if (write(ready_out, "R", 1) != 1)
7473
err(EXIT_FAILURE, "CLIENT: ready write");
7574

7675
/* Wait for "GO" signal */
@@ -85,6 +84,7 @@ static void *sender(struct sender_context *ctx)
8584
unsigned int i, j;
8685

8786
ready(ctx->ready_out, ctx->wakefd);
87+
memset(data, 'S', sizeof(data));
8888

8989
/* Now pump to every receiver. */
9090
for (i = 0; i < nr_loops; i++) {

0 commit comments

Comments
 (0)