[LTP] [PATCH v2 1/2] Refactoring aio-stress.c using LTP API

Richard Palethorpe rpalethorpe@suse.de
Tue Jan 4 12:49:00 CET 2022


Hello Petr,

Petr Vorel <pvorel@suse.cz> writes:

> Hi Andrea,
>
> ...
>>  			for (i = 0; i < io->io_oper->reclen; i++) {
>>  				if (io->buf[i] != verify_buf[i]) {
>> -					fprintf(stderr, "%d:%c:%c ", i,
>> -						io->buf[i], verify_buf[i]);
>> +					ret = asprintf(&msg, "%d:%c:%c ", i, io->buf[i], verify_buf[i]);
>> +					if (ret < 0)
>> +						tst_brk(TBROK, "asprintf memory allocation error");
>> +					ptr += sprintf(ptr, msg);
> Actually, this is problematic for -Werror=format-security which we use in CI.
> Simple "%s" fixes that. It can be done before merge.
>
> ptr += sprintf(ptr, "%s", msg); 
>
> @Richie: I wonder if make check could also actually compile the code with
> extra CFLAGS from build.sh.

Compiling during make-check may confuse things; we don't want make-check
to produce build artifacts. Although I guess you could skip the later
compilation steps. Also then we could add -fanalyzer on gcc which I have
done in a test project[1]. Possibly Clang has something similar,
hhmmmm...

Probably this would require different flags on GCC and Clang. We could
also run both GCC and Clang if they are present. It's probably worth
experimenting with.

[1]: https://richiejp.com/zc-data#meson

-- 
Thank you,
Richard.


More information about the ltp mailing list