From: Michal Bloch Date: Wed, 26 Jan 2022 14:38:00 +0000 (+0100) Subject: Fix a type signedness mismatch X-Git-Tag: submit/tizen_6.5/20220314.044848~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed6b7f2672c98b1f35bd5ab70789e06cde188222;p=platform%2Fkernel%2Flinux-tizen-modules-source.git Fix a type signedness mismatch For size < 4, `char` was still cast to `unsigned` because of the earlier operands, which also involved int promotion (so behaved the same as size == 4). Change-Id: I7b9332bb20dd9d0035fc4607cb29a68cb82d0612 Signed-off-by: Michal Bloch (cherry picked from commit bb64eb2960ff694e4dfebe331d13d1bbc7170d5b) --- diff --git a/tests/kdbus/kdbus-util.c b/tests/kdbus/kdbus-util.c index 85ea297..812e986 100644 --- a/tests/kdbus/kdbus-util.c +++ b/tests/kdbus/kdbus-util.c @@ -797,10 +797,12 @@ wur int kdbus_msg_dump(const struct kdbus_msg *msg) { break; } + /* FIXME: what if `size` is far more than 8? Can't the memfd have like, 500 size? + * Originally this was simply %s/buf so showing only the first number sounds off */ kdbus_printf(" +%s (%llu bytes) fd=%i size=%llu filesize=%llu '0x%llx'\n", enum_MSG(item->type), item->size, item->memfd.fd, (unsigned long long)item->memfd.size, - (unsigned long long)size, (unsigned long long)(size >= 8 ? *(unsigned long long *)buf : size >= 4 ? *(unsigned *)buf : *buf)); + (unsigned long long)size, (unsigned long long)(size >= 8 ? *(uint64_t *)buf : size >= 4 ? *(uint32_t *)buf : size >= 2 ? *(uint16_t *)buf : *(uint8_t *)buf)); munmap(buf, item->memfd.size); break; }