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

Petr Vorel pvorel@suse.cz
Thu May 23 18:19:44 CEST 2024


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


More information about the ltp mailing list