From: Leon Romanovsky <leon@kernel.org>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Peter Oberparleiter <oberpar@linux.ibm.com>,
linux-kernel@vger.kernel.org,
Colin Ian King <colin.king@canonical.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH rdma-next 2/4] gcov: Use proper duplication routine for const pointer
Date: Thu, 3 Sep 2020 13:38:19 +0300 [thread overview]
Message-ID: <20200903103819.GA1137836@unreal> (raw)
In-Reply-To: <eb874b37-3e3f-6819-78f7-bba3e684ae27@rasmusvillemoes.dk>
On Thu, Sep 03, 2020 at 10:56:38AM +0200, Rasmus Villemoes wrote:
> On 02/09/2020 10.55, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@nvidia.com>
> >
> > The filename is a const pointer, so use the proper string duplication
> > routine that takes into account const identifier.
>
> This commit log makes no sense at all.
>
> kstrdup_const is merely an optimization that can be used when there's a
> good chance that the passed string lives in vmlinux' .rodata, in which
> case it is known to be immortal, and we can avoid allocating heap memory
> to contain a duplicate. [It also requires that the caller has no
> intention of modifying the returned string.]
>
> In the case of something called ->filename, I assume it's initialized
> with __FILE__ somewhere, making the above true for built-in stuff but
> not for modules. So if the gcov_info can live longer than the module,
> it's of course necessary to duplicate the string, but OTOH making an
> optimization for the built-in stuff makes sense. So this is certainly
> one of the places where kstrdup_const() seems applicable. But it has
> nothing whatsoever to do with the C-level qualifiers the argument may have.
Thanks, GCOV can't be built as module.
>
> Rasmus
next prev parent reply other threads:[~2020-09-03 10:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 8:55 [PATCH -rc 0/4] Protect from GCC garbage input in GCOV Leon Romanovsky
2020-09-02 8:55 ` [PATCH rdma-next 1/4] gcov: Open-code kmemdup() to work correctly with kernel and user space pointers Leon Romanovsky
2020-09-02 17:38 ` Linus Torvalds
2020-09-02 17:46 ` Leon Romanovsky
2020-09-02 18:27 ` Linus Torvalds
2020-09-02 18:44 ` Leon Romanovsky
2020-09-02 19:04 ` Linus Torvalds
2020-09-02 8:55 ` [PATCH rdma-next 2/4] gcov: Use proper duplication routine for const pointer Leon Romanovsky
2020-09-03 8:56 ` Rasmus Villemoes
2020-09-03 10:38 ` Leon Romanovsky [this message]
2020-09-02 8:55 ` [PATCH rdma-next 3/4] gcov: Protect from uninitialized number of functions provided by GCC 10.2 Leon Romanovsky
2020-09-02 17:41 ` Linus Torvalds
2020-09-02 8:55 ` [PATCH rdma-next 4/4] gcov: Don't print out-of-memory print for all failed files Leon Romanovsky
2020-09-02 17:42 ` [PATCH -rc 0/4] Protect from GCC garbage input in GCOV Linus Torvalds
2020-09-02 17:52 ` Leon Romanovsky
2020-09-02 18:24 ` Linus Torvalds
2020-09-02 18:28 ` Leon Romanovsky
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=20200903103819.GA1137836@unreal \
--to=leon@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=colin.king@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=oberpar@linux.ibm.com \
--cc=torvalds@linux-foundation.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