sound: soc: fsl: Fix memory leak in imx-audmux.c
Subsystems (4)
PATCH v2 1/1 sound: soc: fsl: Fix memory leak in imx-audmux.c
When audmux_clk is used and clk_prepare_enable function succeed, the memory alloc'd to buf variable is leaked
--- sound/soc/fsl/imx-audmux.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/fsl/imx-audmux.c +5 -4
@@ -66,13 +66,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { ssize_t ret; -char *buf =kmalloc (PAGE_SIZE ,GFP_KERNEL ); +char *buf;int port = (int )file->private_data;u32 pdcr, ptcr; -if (!buf) -return -ENOMEM ; -if (audmux_clk) { ret =clk_prepare_enable (audmux_clk);if (ret)
@@ -85,6 +82,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,if (audmux_clk)clk_disable_unprepare (audmux_clk); + buf =kmalloc (PAGE_SIZE ,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + ret =snprintf (buf,PAGE_SIZE ,"PDCR: %08x\nPTCR: %08x\n" , pdcr, ptcr);
Signature · 1 line
1.7.10.4
Quoted 4 lines · Felipe Pena
When
audmux_clkis used andclk_prepare_enablefunction succeed, the memory alloc'd to buf variable is leakedSigned-off-by Felipe Pena <[email protected]>
Looks good.
If you send a v2 please next time also write what changed to the previous version.
Sascha
Quoted 42 lines
--- sound/soc/fsl/imx-audmux.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)sound/soc/fsl/imx-audmux.c +5
-4@@ -66,13 +66,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { ssize_t ret; -char *buf =kmalloc (PAGE_SIZE ,GFP_KERNEL ); +char *buf;int port = (int )file->private_data;u32 pdcr, ptcr; -if (!buf) -return -ENOMEM ; -if (audmux_clk) { ret =clk_prepare_enable (audmux_clk);if (ret)@@ -85,6 +82,10 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,if (audmux_clk)clk_disable_unprepare (audmux_clk); + buf =kmalloc (PAGE_SIZE ,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + ret =snprintf (buf,PAGE_SIZE ,"PDCR: %08x\nPTCR: %08x\n" , pdcr, ptcr);Signature · 6 lines
1.7.10.4 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Mark Brown
maintainerQuoted 2 lines · Felipe Pena
When
audmux_clkis used andclk_prepare_enablefunction succeed, the memory alloc'd to buf variable is leaked
Applied, thanks. Please try to use subject lines appropriate for the subsystem and keep your CC lists focused - you want to send to maintainers and people working on the specific code but it's best to avoid people working on tree wide cleanups like Bill so they don't get too much spam.
Hi,
Quoted 9 lines · Mark Brown
Quoted 2 lines · Felipe Pena
When
audmux_clkis used andclk_prepare_enablefunction succeed, the memory alloc'd to buf variable is leakedApplied, thanks. Please try to use subject lines appropriate for the subsystem and keep your CC lists focused - you want to send to maintainers and people working on the specific code but it's best to avoid people working on tree wide cleanups like Bill so they don't get too much spam.
Thanks guys for accepting the patch. Sorry for inconvenience about the subject line.
About the CC list I just use the one that I get from scripts/get_maintainer.pl.
Signature · 2 lines
Regards, Felipe Pena
Mark Brown
maintainerQuoted 1 line · Felipe Pena
About the CC list I just use the one that I get from
scripts/get_maintainer.pl.
Yeah, that's the most common reason - get_maintianer tends to pick up extra people. You really need to look at the list of people it generates and why they're there, if they're there due to git commits they might just have been doing some generic work.