[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240924051027.GJ38742@google.com>
Date: Tue, 24 Sep 2024 14:10:27 +0900
From: Sergey Senozhatsky <senozhatsky@...omium.org>
To: Andrey Skvortsov <andrej.skvortzov@...il.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Venkat Rao Bagalkote <venkat88@...ux.vnet.ibm.com>,
Minchan Kim <minchan@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Jens Axboe <axboe@...nel.dk>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH v3] zram: don't free statically defined names
On (24/09/24 01:41), Andrey Skvortsov wrote:
[..]
> > > +++ b/drivers/block/zram/zram_drv.c
> > > @@ -2115,8 +2115,10 @@ static void zram_destroy_comps(struct zram *zram)
> > > zram->num_active_comps--;
> > > }
> > > - for (prio = ZRAM_SECONDARY_COMP; prio < ZRAM_MAX_COMPS; prio++) {
> > > - kfree(zram->comp_algs[prio]);
> > > + for (prio = ZRAM_PRIMARY_COMP; prio < ZRAM_MAX_COMPS; prio++) {
> > > + /* Do not free statically defined compression algorithms */
> > > + if (zram->comp_algs[prio] != default_compressor)
> > > + kfree(zram->comp_algs[prio]);
> >
> > Hi,
> >
> > maybe kfree_const() to be more future proof and less verbose?
>
> kfree_const() will not work if zram is built as a module. It works
> only for .rodata for kernel image. [1]
Indeed. It probably shouldn't even be exported; same for
kstrdup_const() [1]
[1] https://lore.kernel.org/linux-mm/20240924050937.697118-1-senozhatsky@chromium.org
Powered by blists - more mailing lists