Re: [LTP] [PATCH] syscalls/msgstress01: Fix off by one in array access

Petr Vorel
2024-05-23T16:20:06Z

Hi Cyril,

> - for (int i = 0; i < size; i++) {
> + for (int i = 0; i < msg_recv.data.len; i++) {
> if (msg_recv.data.pbytes[i] != buff->msg.data.pbytes[i]) {
> tst_res(TFAIL, "Received wrong data at index %d: %x != %x", i,
> msg_recv.data.pbytes[i],

Reviewed-by: Petr Vorel <pvorel@suse.cz>

And FYI (old, unimportant warning): musl 32bit complains about off_t being long
long int. Not sure if we bother (after the release) to %lld + cast to (long long int).

../../../../../include/tst_safe_macros.h:284:50: warning: format '%ld' expects argument of type 'long int', but argument 11 has type 'off_t' {aka 'long long int'} [-Wformat=]
284 | "mmap(%p, %zu, %s(%x), %d, %d, %ld)",
| ~~^
| |
| long int
| %lld
285 | addr, length, prot_buf, prot, flags, fd, offset);
| ~~~~~~
| |
| off_t {aka long long int}

Kind regards,
Petr