public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: stable@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ian Rogers <irogers@google.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH linux-5.15.y v2] perf machine: Use path__join() to compose a path instead of snprintf(dir, '/', filename)
Date: Tue, 13 Sep 2022 08:52:59 +0800	[thread overview]
Message-ID: <Yx/Ua0GmUmKZMf5B@xhacker> (raw)
In-Reply-To: <Yx9E1jONX0n20azE@kroah.com>

On Mon, Sep 12, 2022 at 04:40:22PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Sep 12, 2022 at 04:15:22PM +0800, Jisheng Zhang wrote:
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> > 
> > commit 9d5f0c36438eeae7566ca383b2b673179e3cc613 upstream.
> > 
> > Its more intention revealing, and if we're interested in the odd cases
> > where this may end up truncating we can do debug checks at one
> > centralized place.
> > 
> > Motivation, of all the container builds, fedora rawhide started
> > complaining of:
> > 
> >   util/machine.c: In function ‘machine__create_modules’:
> >   util/machine.c:1419:50: error: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size between 0 and 4095 [-Werror=format-truncation=]
> >    1419 |                 snprintf(path, sizeof(path), "%s/%s", dir_name, dent->d_name);
> >         |                                                  ^~
> >   In file included from /usr/include/stdio.h:894,
> >                    from util/branch.h:9,
> >                    from util/callchain.h:8,
> >                    from util/machine.c:7:
> >   In function ‘snprintf’,
> >       inlined from ‘maps__set_modules_path_dir’ at util/machine.c:1419:3,
> >       inlined from ‘machine__set_modules_path’ at util/machine.c:1473:9,
> >       inlined from ‘machine__create_modules’ at util/machine.c:1519:7:
> >   /usr/include/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 2 and 4352 bytes into a destination of size 4096
> > 
> > There are other places where we should use path__join(), but lets get rid of
> > this one first.
> > 
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Acked-by: Ian Rogers <irogers@google.com>
> > Link: Link: https://lore.kernel.org/r/YebZKjwgfdOz0lAs@kernel.org
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> As you are forwarding on this commit, you too need to sign-off on it.

Thanks for the information.

> 
> > ---
> > 
> > Since v1:
> >  - add commit id in upstream.
> >  - add linux-5.15.y, maybe we also need this for other long term stable
> >    tree.
> 
> Why is this needed in 5.15?

Building linux-5.15.y perf with gcc-12 will emit the same error as the
commit msg says.

Thanks

      reply	other threads:[~2022-09-13  1:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12  8:15 [PATCH linux-5.15.y v2] perf machine: Use path__join() to compose a path instead of snprintf(dir, '/', filename) Jisheng Zhang
2022-09-12 14:40 ` Greg Kroah-Hartman
2022-09-13  0:52   ` Jisheng Zhang [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=Yx/Ua0GmUmKZMf5B@xhacker \
    --to=jszhang@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=stable@vger.kernel.org \
    /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