MLK-11915-12 ASoC: fsl_asrc_m2m: fix null check issue for variable m2m and pair
authorZidan Wang <zidan.wang@freescale.com>
Fri, 27 Nov 2015 05:50:12 +0000 (13:50 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:19 +0000 (14:49 -0500)
commit09f64aa90034f69f9f6817c316bbc54b22595a66
tree2b259a4099fbf290770e5998b385c0e2ab450525
parent89dc98d54d9f06cbc078d95d5118bc11fe11dd99
MLK-11915-12 ASoC: fsl_asrc_m2m: fix null check issue for variable m2m and pair

After allocating memory for m2m, we should null check for m2m instead of pair.

In fsl_asrc_close(), null-checking pair suggests that it may be null, but it
has already been dereferenced before the null check. pair will be alloceted
in fsl_asrc_open(), pair is null means that open dev file failed, and
close should not be called in user space. So remove null check for pair.

buf_len should not greater than ASRC_DMA_BUFFER_SIZE, otherwith dma buffer will
be overrun.

Reported by Coverity.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
(cherry picked from commit b0dc15375b12b6c1bf46b9071b92267b827d8ce0)
sound/soc/fsl/fsl_asrc_m2m.c