diff options
author | Zeng Heng <zengheng4@huawei.com> | 2022-11-14 09:56:29 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-11-14 12:30:30 +0100 |
commit | ec7bf231aaa1bdbcb69d23bc50c753c80fb22429 (patch) | |
tree | 1bf554e83c10b53122ac814f5b38fef9a7eb3cc1 /sound | |
parent | ASoC: codecs: Remove a useless include (diff) | |
download | linux-ec7bf231aaa1bdbcb69d23bc50c753c80fb22429.tar.xz linux-ec7bf231aaa1bdbcb69d23bc50c753c80fb22429.zip |
ASoC: pxa: fix null-pointer dereference in filter()
kasprintf() would return NULL pointer when kmalloc() fail to allocate.
Need to check the return pointer before calling strcmp().
Fixes: 7a824e214e25 ("ASoC: mmp: add audio dma support")
Signed-off-by: Zeng Heng <zengheng4@huawei.com>
Link: https://lore.kernel.org/r/20221114085629.1910435-1-zengheng4@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/pxa/mmp-pcm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c index 5d520e18e512..99b245e3079a 100644 --- a/sound/soc/pxa/mmp-pcm.c +++ b/sound/soc/pxa/mmp-pcm.c @@ -98,7 +98,7 @@ static bool filter(struct dma_chan *chan, void *param) devname = kasprintf(GFP_KERNEL, "%s.%d", dma_data->dma_res->name, dma_data->ssp_id); - if ((strcmp(dev_name(chan->device->dev), devname) == 0) && + if (devname && (strcmp(dev_name(chan->device->dev), devname) == 0) && (chan->chan_id == dma_data->dma_res->start)) { found = true; } |