From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] objtool: check: give big enough buffer for pv_ops
Date: Thu, 20 Jan 2022 15:09:32 -0800 [thread overview]
Message-ID: <20220120230932.vgd3sj4yuk7mhmno@treble> (raw)
In-Reply-To: <20220120225810.zqpbug6oj52c34cg@treble>
On Thu, Jan 20, 2022 at 02:58:13PM -0800, Josh Poimboeuf wrote:
> On Fri, Jan 14, 2022 at 09:53:07AM +0100, Peter Zijlstra wrote:
> > 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!
>
> Alternatively, 'idx' could just be unsigned char, since pv_ops only has
> about ~80 entries max, but either way works for me. I'll queue it up.
Sergei, can you send a v2 with a valid Signed-off-by tag?
--
Josh
next prev parent reply other threads:[~2022-01-20 23:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 7:57 [PATCH] objtool: check: give big enough buffer for pv_ops Sergei Trofimovich
2022-01-14 8:53 ` Peter Zijlstra
2022-01-20 22:58 ` Josh Poimboeuf
2022-01-20 23:09 ` Josh Poimboeuf [this message]
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=20220120230932.vgd3sj4yuk7mhmno@treble \
--to=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).