]> www.infradead.org Git - users/hch/misc.git/commitdiff
ASoC: codecs: fs210x: Add NULL check in fs210x_register_snd_component
authorCharles Han <hanchunchao@inspur.com>
Fri, 5 Sep 2025 09:18:44 +0000 (17:18 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 5 Sep 2025 10:57:51 +0000 (11:57 +0100)
Add check for the return value of devm_kmemdup() to prevent
potential null pointer dereference.

Fixes: 756117701779 ("ASoC: codecs: Add FourSemi FS2104/5S audio amplifier driver")
Signed-off-by: Charles Han <hanchunchao@inspur.com>
Message-ID: <20250905091845.1559-1-hanchunchao@inspur.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/fs210x.c

index b4f51ee7235abec422d983289b0748b8d2533fec..e2f85714972d559f33006dffc8f25cf16b849aac 100644 (file)
@@ -1458,6 +1458,9 @@ static int fs210x_register_snd_component(struct fs210x_priv *fs210x)
        dai_drv->name = devm_kasprintf(fs210x->dev,
                                       GFP_KERNEL, "%s-%d",
                                       dai_drv->name, instance_id);
+       if (!dai_drv->name)
+               return -ENOMEM;
+
        instance_id++;
 
        if (fs210x->devid == FS2105S_DEVICE_ID) {