Commit 7c0cedd8 authored by Michael Holzheu's avatar Michael Holzheu Committed by Andrei Vagin

zdtm/s390x_regs_check: Fix compiler warning

When running 'make zdtm' on s390x it fails on RHEL7 with:

 make[3]: Leaving directory `/tmp/criu/test/zdtm/lib'
  CC        s390x_regs_check.o
 s390x_regs_check.c: In function "util_hexdump_grp":
 s390x_regs_check.c:214:7: error: "ptr" may be used uninitialized
 in this function [-Werror=maybe-uninitialized]
    ptr += sprintf(ptr, "%02x", buf[i]);

Fix this and assign ptr from the beginning to help gcc.
Reported-by: 's avatarAdrian Reber <adrian@lisas.de>
Signed-off-by: 's avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Acked-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent c1e68a94
......@@ -198,8 +198,8 @@ struct reg_set *reg_set_vec[] = {
void util_hexdump_grp(const char *tag, const void *data, int grp,
int count, int indent)
{
char str[1024], *ptr = str;
const char *buf = data;
char str[1024], *ptr;
int i, first = 1;
for (i = 0; i < count; 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