diff mbox series

[2/2] pinctrl: mediatek: Initialize variable *buf to zero

Message ID 20230118062036.26258-3-Guodong.Liu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series MediaTek pinctrl cleanups and improvements | expand

Commit Message

Guodong Liu Jan. 18, 2023, 6:20 a.m. UTC
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>
---
 drivers/pinctrl/mediatek/pinctrl-paris.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

AngeloGioacchino Del Regno Jan. 18, 2023, 11:26 a.m. UTC | #1
Il 18/01/23 07:20, Guodong Liu ha scritto:
> 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>
diff mbox series

Patch

diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index e736c1610f3c..d2fbfffda038 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -714,7 +714,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);