[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200903103819.GA1137836@unreal>
Date: Thu, 3 Sep 2020 13:38:19 +0300
From: Leon Romanovsky <leon@...nel.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Oberparleiter <oberpar@...ux.ibm.com>,
linux-kernel@...r.kernel.org,
Colin Ian King <colin.king@...onical.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH rdma-next 2/4] gcov: Use proper duplication routine for
const pointer
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@...dia.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
Powered by blists - more mailing lists