[PATCH v2] soc: mediatek: svs: Fix memory leak in svs_enable_debug_write()

Zilin Guan zilin at seu.edu.cn
Mon Dec 29 05:17:12 PST 2025


On Mon, Dec 29, 2025 at 09:19:19AM +0100, Markus Elfring wrote:
>> > +++ b/drivers/soc/mediatek/mtk-svs.c
> > @@ -789,7 +789,7 @@ static ssize_t svs_enable_debug_write(struct file *filp,
> >  	struct svs_bank *svsb = file_inode(filp)->i_private;
> >  	struct svs_platform *svsp = dev_get_drvdata(svsb->dev);
> >  	int enabled, ret;
> > -	char *buf = NULL;
> > +	char *buf __free(kfree) = NULL;
> >  
> >  	if (count >= PAGE_SIZE)
> >  		return -EINVAL;
>> 
> You may reduce the scopes for involved local variables,
> don't you?

Thanks for your suggestion. I will reduce the scope of the local variables 
in v3.

> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc3#n262
> 
> Regards,
> Markus

Thanks, I will add your suggested Cc tag in v3.

Regards,
Zilin Guan



More information about the linux-arm-kernel mailing list