public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: Daniel Wagner <wagi@monom.org>
Cc: Clark Williams <williams@redhat.com>, linux-rt-users@vger.kernel.org
Subject: Re: [PATCH rt-tests v1 v1 4/4] deadline_test: Increase buffer to avoid overflow
Date: Fri, 23 Aug 2019 17:20:36 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.21.1908231720220.7154@planxty> (raw)
In-Reply-To: <20190819064304.4676-5-wagi@monom.org>

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



On Mon, 19 Aug 2019, Daniel Wagner wrote:

> Increase the size of the char buffer. gcc 9.1.1 reports:
> 
> src/sched_deadline/deadline_test.c:1803:24: warning: ‘%d’ directive writing between 1 and 11 bytes into a region of size 10 [-Wformat-overflow=]
>  1803 |   sprintf(setcpu_buf, "%d", cpu_count - 1);
>       |                        ^~
> src/sched_deadline/deadline_test.c:1803:23: note: directive argument in the range [-2147483648, 2147483646]
>  1803 |   sprintf(setcpu_buf, "%d", cpu_count - 1);
>       |                       ^~~~
> src/sched_deadline/deadline_test.c:1803:3: note: ‘sprintf’ output between 2 and 12 bytes into a destination of size 10
>  1803 |   sprintf(setcpu_buf, "%d", cpu_count - 1);
>       |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Daniel Wagner <wagi@monom.org>
> ---
>  src/sched_deadline/deadline_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
> index e2898de328bb..5b5f40dbb74d 100644
> --- a/src/sched_deadline/deadline_test.c
> +++ b/src/sched_deadline/deadline_test.c
> @@ -1795,7 +1795,7 @@ int main (int argc, char **argv)
>  
>  	/* -b has us bind to the last CPU. */
>  	if (!all_cpus && !setcpu) {
> -		setcpu_buf = malloc(10);
> +		setcpu_buf = malloc(12);
>  		if (!setcpu_buf) {
>  			perror("malloc");
>  			exit(-1);
> -- 
> 2.21.0
> 
Signed-off-by: John Kacur <jkacur@redhat.com>

      reply	other threads:[~2019-08-23 15:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19  6:43 [PATCH rt-tests v1 v1 0/4] Fix gcc warning Daniel Wagner
2019-08-19  6:43 ` [PATCH rt-tests v1 v1 1/4] pmqtest: Increase buffer to avoid overflow Daniel Wagner
2019-08-23 15:15   ` John Kacur
2019-08-19  6:43 ` [PATCH rt-tests v1 v1 2/4] sigwaittest: " Daniel Wagner
2019-08-23 15:17   ` John Kacur
2019-08-19  6:43 ` [PATCH rt-tests v1 v1 3/4] svsematest: " Daniel Wagner
2019-08-23 15:19   ` John Kacur
2019-08-19  6:43 ` [PATCH rt-tests v1 v1 4/4] deadline_test: " Daniel Wagner
2019-08-23 15:20   ` John Kacur [this message]

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=alpine.LFD.2.21.1908231720220.7154@planxty \
    --to=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=wagi@monom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox