From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: Richard Palethorpe <rpalethorpe@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 1/2] Refactoring aio-stress.c using LTP API
Date: Tue, 4 Jan 2022 09:34:46 +0100 [thread overview]
Message-ID: <YdQGplLdFnsmhlSO@pevik> (raw)
In-Reply-To: <20220104073754.721-2-andrea.cervesato@suse.com>
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.
...
> for (i = 0; i < DEVIATIONS; i++) {
> - fprintf(stderr, " %.0f < %d", lat->deviations[i],
> - deviations[i]);
> + ret = asprintf(&msg, " %.0f < %d", lat->deviations[i], deviations[i]);
> + if (ret < 0)
> + tst_brk(TBROK, "asprintf memory allocation error");
> + ptr += sprintf(ptr, msg);
And here as well.
> total_counted += lat->deviations[i];
> + free(msg);
> }
> - if (total_counted && lat->total_io - total_counted)
> - fprintf(stderr, " < %.0f", lat->total_io - total_counted);
> - fprintf(stderr, "\n");
> +
> + if (total_counted && lat->total_io - total_counted) {
> + ret = asprintf(&msg, " < %.0f", lat->total_io - total_counted);
> + if (ret < 0)
> + tst_brk(TBROK, "asprintf memory allocation error");
> + ptr += sprintf(ptr, msg);
and here.
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-01-04 8:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-04 7:37 [LTP] [PATCH v2 0/2] aio-stress.c refactoring Andrea Cervesato via ltp
2022-01-04 7:37 ` [LTP] [PATCH v2 1/2] Refactoring aio-stress.c using LTP API Andrea Cervesato via ltp
2022-01-04 8:27 ` Petr Vorel
2022-01-04 8:34 ` Petr Vorel [this message]
2022-01-04 11:49 ` Richard Palethorpe
2022-01-04 12:22 ` Petr Vorel
2022-01-04 7:37 ` [LTP] [PATCH v2 2/2] Update ltp-aio-stress suites using new options Andrea Cervesato via ltp
2022-01-04 8:35 ` Petr Vorel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YdQGplLdFnsmhlSO@pevik \
--to=pvorel@suse.cz \
--cc=andrea.cervesato@suse.com \
--cc=ltp@lists.linux.it \
--cc=rpalethorpe@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox