Patch "ASoC: max98373: Add checks for devm_kcalloc" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: max98373: Add checks for devm_kcalloc

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-max98373-add-checks-for-devm_kcalloc.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 853896dcfd7950ef0375f74449569308f8a9ddf5
Author: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
Date:   Wed Nov 16 16:25:08 2022 +0800

    ASoC: max98373: Add checks for devm_kcalloc
    
    [ Upstream commit 60591bbf6d5eb44f275eb733943b7757325c1b60 ]
    
    As the devm_kcalloc may return NULL pointer,
    it should be better to check the return value
    in order to avoid NULL poineter dereference.
    
    Fixes: 349dd23931d1 ("ASoC: max98373: don't access volatile registers in bias level off")
    Signed-off-by: Jiasheng Jiang <jiasheng@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221116082508.17418-1-jiasheng@xxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/codecs/max98373-i2c.c b/sound/soc/codecs/max98373-i2c.c
index ddb6436835d7..68497a4521dd 100644
--- a/sound/soc/codecs/max98373-i2c.c
+++ b/sound/soc/codecs/max98373-i2c.c
@@ -551,6 +551,10 @@ static int max98373_i2c_probe(struct i2c_client *i2c,
 	max98373->cache = devm_kcalloc(&i2c->dev, max98373->cache_num,
 				       sizeof(*max98373->cache),
 				       GFP_KERNEL);
+	if (!max98373->cache) {
+		ret = -ENOMEM;
+		return ret;
+	}
 
 	for (i = 0; i < max98373->cache_num; i++)
 		max98373->cache[i].reg = max98373_i2c_cache_reg[i];



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux