Re: [PATCH v3] zram: don't free statically defined names

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux