pinctrl: mediatek: Initialize variable *buf to zero
authorGuodong Liu <Guodong.Liu@mediatek.com>
Wed, 18 Jan 2023 06:20:36 +0000 (14:20 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:16 +0000 (09:33 +0100)
[ Upstream commit 2e34f82ba214134ecf590fbe0cdbd87401645a8a ]

Coverity spotted that *buf is not initialized to zero in
mtk_pctrl_dbg_show. Using uninitialized variable *buf as argument to %s
when calling seq_printf. Fix this coverity by initializing *buf as zero.

Fixes: 184d8e13f9b1 ("pinctrl: mediatek: Add support for pin configuration dump via debugfs.")
Signed-off-by: Guodong Liu <Guodong.Liu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230118062036.26258-3-Guodong.Liu@mediatek.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/mediatek/pinctrl-paris.c

index 3b5c935..ad873bd 100644 (file)
@@ -712,7 +712,7 @@ static void mtk_pctrl_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
                          unsigned int gpio)
 {
        struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev);
-       char buf[PIN_DBG_BUF_SZ];
+       char buf[PIN_DBG_BUF_SZ] = { 0 };
 
        (void)mtk_pctrl_show_one_pin(hw, gpio, buf, PIN_DBG_BUF_SZ);