Patch "i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()" has been added to the 5.4-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

    i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()

to the 5.4-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:
     i2c-mux-demux-pinctrl-check-the-return-value-of-devm.patch
and it can be found in the queue-5.4 subdirectory.

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



commit 47d8df8ebb52255644c97ae89ff6eb2ea82ffdbb
Author: Xiaoke Wang <xkernel.wang@xxxxxxxxxxx>
Date:   Thu Mar 3 20:39:14 2022 +0800

    i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()
    
    [ Upstream commit 7c0195fa9a9e263df204963f88a22b21688ffb66 ]
    
    devm_kstrdup() returns pointer to allocated string on success,
    NULL on failure. So it is better to check the return value of it.
    
    Fixes: e35478eac030 ("i2c: mux: demux-pinctrl: run properly with multiple instances")
    Signed-off-by: Xiaoke Wang <xkernel.wang@xxxxxxxxxxx>
    Signed-off-by: Wolfram Sang <wsa@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/i2c/muxes/i2c-demux-pinctrl.c b/drivers/i2c/muxes/i2c-demux-pinctrl.c
index f7a7405d4350a..8e8688e8de0fb 100644
--- a/drivers/i2c/muxes/i2c-demux-pinctrl.c
+++ b/drivers/i2c/muxes/i2c-demux-pinctrl.c
@@ -243,6 +243,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev)
 
 		props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL);
 		props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
+		if (!props[i].name || !props[i].value) {
+			err = -ENOMEM;
+			goto err_rollback;
+		}
 		props[i].length = 3;
 
 		of_changeset_init(&priv->chan[i].chgset);



[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