From patchwork Wed Jan 18 06:20:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guodong Liu X-Patchwork-Id: 13105645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB2F9C004D4 for ; Wed, 18 Jan 2023 06:22:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BK5O9JqkjXimdgm/Fs0QdQBnNDOxjDVCgha8nXC0PH4=; b=1AdbPO8j6T0MEJ 8ROHcEw6MeEMUy0vaVtB6y8JsMIJ/MSEnjuRJj20Z9Gjjq593di9XoHRWIP6k8U3jBXsg02m8GJBZ w7EfjNDxTDdisyyTYP0GDEM/CnKKWZq9/FNTvUc1rrcswmsqIgW10vRQS7Ufz00rq3sY8/btALblD NQbtSFCQqEsUCNQdXq/SfszliLA7/DnRYo7fzlYxVh8If9L7wNy1vlhYRx5udqZgUa/Nt7+Gq/zMv pOpW/O4rRbzc7mbwpABdx+67XvV1/2NArNd1/DK4mLO8bObDP63042LUud+T4WVfGEE0tqH/Tbm13 PA8FcDJZiJ+4Fcc3znLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI1pN-00H4Jh-Bu; Wed, 18 Jan 2023 06:21:41 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI1pA-00H4FY-NZ; Wed, 18 Jan 2023 06:21:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=woicIWywMPyEsGfjzqeJZVmpu2C7tQguryCnNThhvE8=; b=eKyD73SKsGv0PHqv79R4QCUjJg i51azXXdj1ijq2uFz0qzFu74gaBD/zg+i0eQNzIQHaFtTx2KeSD8B0myNvp2GFRVdtSDmR5Fp4sF2 Z8CgvNXvkipbP5RJNDBwAXqvX3IJoTFOMk83lzycb+c8Mn/M+U/KlNZmVSrWY5bLmUCF5gGAsqiIJ R+7wm9WV4KUfiDXFS3o5wbGWNA0O8vhRNpOcVG46aFoGLGQu1NQbKB/54K7EPq4ax6KmbthzXlrfu lVu9lu9QW7+4COapE1qM5NulzAeTkuPC/foTxL1R6kN6fhRZgZJLImZ7c+uqD8RVXsznPQaHGK2lX z4FFXqEA==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pI1ox-006B9u-08; Wed, 18 Jan 2023 06:21:17 +0000 X-UUID: 4efb09d896f811eda08d4d6090ec5a5c-20230117 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=woicIWywMPyEsGfjzqeJZVmpu2C7tQguryCnNThhvE8=; b=JdZLevugZXOLN+C2wShJ69Re1kJjMBfPHhXlw5HfJDOhmqxyViXHuoAHC/XBRfcovu+R30bstILwkMRkFsMqqLghTAqjrs5/eH9vTcIkFCKEqF+1oLBnkvqLlZnLVXP7nzIaJyjeMs8EPm0h1Vjg8b0M8JXgycRFqfzLRfHSPPs=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:cd284b90-969d-4ce1-a0c5-b7d37897c672,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:3ca2d6b,CLOUDID:1cb424f6-ff42-4fb0-b929-626456a83c14,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0 X-CID-BVR: 0 X-UUID: 4efb09d896f811eda08d4d6090ec5a5c-20230117 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1202574650; Tue, 17 Jan 2023 23:21:13 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 18 Jan 2023 14:20:40 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 18 Jan 2023 14:20:40 +0800 From: Guodong Liu To: Sean Wang , Linus Walleij , Matthias Brugger , Light Hsieh , Rob Herring , AngeloGioacchino Del Regno CC: , , , , Zhiyong Tao , Guodong Liu Subject: [PATCH 1/2] pinctrl: mediatek: Initialize variable pullen and pullup to zero Date: Wed, 18 Jan 2023 14:20:35 +0800 Message-ID: <20230118062036.26258-2-Guodong.Liu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230118062036.26258-1-Guodong.Liu@mediatek.com> References: <20230118062036.26258-1-Guodong.Liu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230118_062115_801166_D458CEA0 X-CRM114-Status: GOOD ( 14.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Coverity spotted that pullen and pullup is not initialized to zero in mtk_pctrl_show_one_pin. The uninitialized variable pullen is used in assignment statement "rsel = pullen;" in mtk_pctrl_show_one_pin, and Uninitialized variable pullup is used when calling scnprintf. Fix this coverity by initializing pullen and pullup as zero. Fixes: 184d8e13f9b1 ("pinctrl: mediatek: Add support for pin configuration dump via debugfs.") Signed-off-by: Guodong Liu Reviewed-by: AngeloGioacchino Del Regno --- drivers/pinctrl/mediatek/pinctrl-paris.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index f2ce3f626dd1..e736c1610f3c 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -635,7 +635,7 @@ static int mtk_hw_get_value_wrap(struct mtk_pinctrl *hw, unsigned int gpio, int ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, unsigned int gpio, char *buf, unsigned int buf_len) { - int pinmux, pullup, pullen, len = 0, r1 = -1, r0 = -1, rsel = -1; + int pinmux, pullup = 0, pullen = 0, len = 0, r1 = -1, r0 = -1, rsel = -1; const struct mtk_pin_desc *desc; u32 try_all_type = 0; From patchwork Wed Jan 18 06:20:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guodong Liu X-Patchwork-Id: 13105643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C138FC38159 for ; Wed, 18 Jan 2023 06:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zQZe0NjAUzP6Bm5gXdQobTj1r78G0hhRy9ipRBRBwfU=; b=b7sUQIVZySztDm lNi/kGGtTt0k53s0Xym07r8nQDFxCQ9sqLw2BYOUzhTbAAJr0bIqeNTLFaUHsUx9/2YYHdPtcon50 ia2WFMMO4e6BhA149MuuGp0+6NZGlGynsZsTO8WKPBCP2MC+Brncr5sVp2Npt2QL4BgyNtaFNx0Tz Iwi+VWgs0I4UX1bPnofS1QhngXdDsmu7rNhKWEvMyCultamzwpPb5fM1BiiGWzAe25URc9HIvNdDJ J/qZSFG6SGEEFOWgJUlGeQ3vTuI5sFosbaSkw3CNrM4LxpWxrXsSzDcmkU9JnCmvmPlwfIP8EcWlg 6NRy2xquoSJ37c4cGDLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI1oe-00H48R-OW; Wed, 18 Jan 2023 06:20:56 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI1ob-00H47E-SW; Wed, 18 Jan 2023 06:20:55 +0000 X-UUID: 3e26887696f811edbbe3f76fe852e059-20230117 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=tACJKT8XgvyTiNyQ1SOAHE7Bfy7mW7GpFKNZHBdrIsc=; b=WulrVUUiwH0GPjyLa6FPu/WLh1uhjphVYHT8LHvLBIwmPOamMcrymudI4HPo6DW62rH1t1UYx0DUGmXvr9Bh5FEwQSHlHX+urutuNoMlVKJhBKs4ZCI/uj9D3/jxCysw+wc0QBMmeXk1XFdb2l8nl753QAp3dJ+HMKqV/F8GV34=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.18,REQID:798ef059-1805-4c0c-baae-8c8ef428ae25,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-5 X-CID-META: VersionHash:3ca2d6b,CLOUDID:1eb024f6-ff42-4fb0-b929-626456a83c14,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0 X-CID-BVR: 0 X-UUID: 3e26887696f811edbbe3f76fe852e059-20230117 Received: from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 95577842; Tue, 17 Jan 2023 23:20:45 -0700 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Wed, 18 Jan 2023 14:20:43 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Wed, 18 Jan 2023 14:20:42 +0800 From: Guodong Liu To: Sean Wang , Linus Walleij , Matthias Brugger , Light Hsieh , Rob Herring , AngeloGioacchino Del Regno CC: , , , , Zhiyong Tao , Guodong Liu Subject: [PATCH 2/2] pinctrl: mediatek: Initialize variable *buf to zero Date: Wed, 18 Jan 2023 14:20:36 +0800 Message-ID: <20230118062036.26258-3-Guodong.Liu@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230118062036.26258-1-Guodong.Liu@mediatek.com> References: <20230118062036.26258-1-Guodong.Liu@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_222053_943463_8D65B9B1 X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: AngeloGioacchino Del Regno --- drivers/pinctrl/mediatek/pinctrl-paris.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);