lkml.org 
[lkml]   [2020]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] exfat: fix memory leak in exfat_parse_param()
From
Date
> Additionally, there's no point copying param->string in
> exfat_parse_param() - just steal it, leaving NULL in param->string.
> That's independent from the leak or fix thereof - it's simply
> avoiding an extra copy.

I find it clearer to provide such a source code adjustment
by a separate update step.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=d6f9469a03d832dcd17041ed67774ffb5f3e73b3#n138

Please move it into another patch.



> +++ b/fs/exfat/super.c

> @@ -686,7 +685,12 @@ static int exfat_get_tree(struct fs_context *fc)
>
> static void exfat_free(struct fs_context *fc)
> {
> - kfree(fc->s_fs_info);
> + struct exfat_sb_info *sbi = fc->s_fs_info;
> +
> + if (sbi) {
> + exfat_free_iocharset(sbi);
> + kfree(sbi);
> + }
> }


Can it be helpful to annotate the added check according to branch prediction?
Are valid pointers likely at this place?

Regards,
Markus

\
 
 \ /
  Last update: 2020-06-03 08:32    [W:0.030 / U:0.948 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site