mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sergei Trofimovich <slyich@gmail.com>
Cc: linux-kernel@vger.kernel.org, Josh Poimboeuf <jpoimboe@redhat.com>
Subject: Re: [PATCH] objtool: check: give big enough buffer for pv_ops
Date: Fri, 14 Jan 2022 09:53:07 +0100	[thread overview]
Message-ID: <YeE588tXLrgWoUu4@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20220114075756.838243-1-slyich@gmail.com>

On Fri, Jan 14, 2022 at 07:57:56AM +0000, Sergei Trofimovich wrote:
> On gcc-12 build fails flagging possible buffer overflow:
> 
>     check.c: In function 'validate_call':
>     check.c:2865:58: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=]
>      2865 |                 snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
>           |                                                          ^~
> 
> I think it's a valid warning:
> 
>     static char pvname[16];
>     int idx;
>     ...
>     idx = (rel->addend / sizeof(void *));
>     snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx);
> 
> we have only 7 chars for %d while it could take up to 9.

Right, very unlikely to have that many pv_ops, but it doesn't hurt to
fix this.

Thanks!

  reply	other threads:[~2022-01-14  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-14  7:57 Sergei Trofimovich
2022-01-14  8:53 ` Peter Zijlstra [this message]
2022-01-20 22:58   ` Josh Poimboeuf
2022-01-20 23:09     ` Josh Poimboeuf
2022-01-20 23:37       ` [PATCH v2] " Sergei Trofimovich
2022-01-31 12:04         ` [tip: objtool/urgent] objtool: Fix truncated string warning tip-bot2 for Sergei Trofimovich

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=YeE588tXLrgWoUu4@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slyich@gmail.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

all inboxes | Powered by JetHome®