Commit d2c73501 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

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: default avatarIan Rogers <irogers@google.com>
Acked-by: default avatarJiri 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8a39e8c4
...@@ -66,11 +66,10 @@ static void fdpair(int fds[2]) ...@@ -66,11 +66,10 @@ static void fdpair(int fds[2])
/* Block until we're ready to go */ /* Block until we're ready to go */
static void ready(int ready_out, int wakefd) static void ready(int ready_out, int wakefd)
{ {
char dummy;
struct pollfd pollfd = { .fd = wakefd, .events = POLLIN }; struct pollfd pollfd = { .fd = wakefd, .events = POLLIN };
/* Tell them we're ready. */ /* Tell them we're ready. */
if (write(ready_out, &dummy, 1) != 1) if (write(ready_out, "R", 1) != 1)
err(EXIT_FAILURE, "CLIENT: ready write"); err(EXIT_FAILURE, "CLIENT: ready write");
/* Wait for "GO" signal */ /* Wait for "GO" signal */
...@@ -85,6 +84,7 @@ static void *sender(struct sender_context *ctx) ...@@ -85,6 +84,7 @@ static void *sender(struct sender_context *ctx)
unsigned int i, j; unsigned int i, j;
ready(ctx->ready_out, ctx->wakefd); ready(ctx->ready_out, ctx->wakefd);
memset(data, 'S', sizeof(data));
/* Now pump to every receiver. */ /* Now pump to every receiver. */
for (i = 0; i < nr_loops; i++) { for (i = 0; i < nr_loops; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment