All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Daniel Wagner <dwagner@suse.de>
Cc: Clark Williams <williams@redhat.com>, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH rt-tests v2 3/3] cyclicdeadline: Fix buffer allocation
Date: Fri, 9 Jul 2021 14:01:35 -0400 (EDT)	[thread overview]
Message-ID: <64899f-ab54-4a29-73a7-32b79ab6a1e6@redhat.com> (raw)
In-Reply-To: <20210708151827.21430-4-dwagner@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1882 bytes --]



On Thu, 8 Jul 2021, Daniel Wagner wrote:

> gcc complains with "‘sprintf’ output between 2 and 12 bytes" but
> the buffer is only 10 bytes long. Update the buffer size to hold
> the complete range of [-2147483648, 2147483646].
> 
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/sched_deadline/cyclicdeadline.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/sched_deadline/cyclicdeadline.c b/src/sched_deadline/cyclicdeadline.c
> index ffefa9e6fecb..8447424273ee 100644
> --- a/src/sched_deadline/cyclicdeadline.c
> +++ b/src/sched_deadline/cyclicdeadline.c
> @@ -1092,7 +1092,7 @@ int main(int argc, char **argv)
>  
>  	/* Default cpu to use is the last one */
>  	if (!all_cpus && !setcpu) {
> -		setcpu_buf = malloc(10);
> +		setcpu_buf = malloc(12);
>  		if (!setcpu_buf)
>  			fatal("malloc");
>  		sprintf(setcpu_buf, "%d", cpu_count - 1);
> -- 
> 2.32.0
> 
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

I applied this but there are others.

git grep PRIu64
src/oslat/oslat.c:              snprintf(bucket_name, sizeof(bucket_name), 
"%03"PRIu64
src/oslat/oslat.c:              putfield(bucket_name, t[i].buckets[j], 
PRIu64,
src/oslat/oslat.c:      putfield("Minimum", t[i].minlat, PRIu64, " (us)");
src/oslat/oslat.c:      putfield("Maximum", t[i].maxlat, PRIu64, " (us)");
src/oslat/oslat.c:      putfield("Max-Min", t[i].maxlat - t[i].minlat, 
PRIu64, " (us)");
src/oslat/oslat.c:              fprintf(f, "      \"min\": %" PRIu64 
",\n", t[i].minlat);
src/oslat/oslat.c:              fprintf(f, "      \"max\": %" PRIu64 
",\n", t[i].maxlat);
src/oslat/oslat.c:                      fprintf(f, "        \"%" PRIu64 
"\": %" PRIu64,
src/oslat/oslat.c:      printf("Workload mem: \t\t%"PRIu64" (KiB)\n",
src/pi_tests/pi_stress.c:               printf(" runtime %" PRIu64 " 
deadline %" PRIu64 " period %" PRIu64 "\n",

  reply	other threads:[~2021-07-09 18:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 15:18 [PATCH rt-tests v2 0/3] Fix a few fallouts Daniel Wagner
2021-07-08 15:18 ` [PATCH rt-tests v2 1/3] rt-numa: Use sched_getaffinity() instead of pthread_getaffinity_np() Daniel Wagner
2021-07-09 17:58   ` John Kacur
2021-07-19  8:00     ` Daniel Wagner
2021-07-08 15:18 ` [PATCH rt-tests v2 2/3] signaltest: Fix printf format specifier Daniel Wagner
2021-07-08 15:18 ` [PATCH rt-tests v2 3/3] cyclicdeadline: Fix buffer allocation Daniel Wagner
2021-07-09 18:01   ` John Kacur [this message]
2021-07-19  8:05     ` Daniel Wagner
2021-07-09 18:02   ` John Kacur

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=64899f-ab54-4a29-73a7-32b79ab6a1e6@redhat.com \
    --to=jkacur@redhat.com \
    --cc=dwagner@suse.de \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=williams@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.