public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: typec: qcom-pmic: fix uninitialized value hdr_len and txbuf_len
@ 2024-10-29  2:18 Rex Nie
  2024-10-29  2:30 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Rex Nie @ 2024-10-29  2:18 UTC (permalink / raw)
  To: bryan.odonoghue, heikki.krogerus
  Cc: gregkh, linux-arm-msm, linux-usb, linux-kernel, angus.chen,
	Rex Nie

If the read of USB_PDPHY_RX_ACKNOWLEDGE_REG failed, then hdr_len and
txbuf_len are uninitialized. It makes no sense to print message header
and payload. It is also not safe to print uninitialized length of ram.

Signed-off-by: Rex Nie <rex.nie@jaguarmicro.com>
---
 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
index 5b7f52b74a40..53c2180a773a 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
@@ -221,7 +221,7 @@ qcom_pmic_typec_pdphy_pd_transmit_payload(struct pmic_typec_pdphy *pmic_typec_pd
 					  unsigned int negotiated_rev)
 {
 	struct device *dev = pmic_typec_pdphy->dev;
-	unsigned int val, hdr_len, txbuf_len, txsize_len;
+	unsigned int val, hdr_len = 0, txbuf_len = 0, txsize_len;
 	unsigned long flags;
 	int ret;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-11-02 12:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29  2:18 [PATCH] usb: typec: qcom-pmic: fix uninitialized value hdr_len and txbuf_len Rex Nie
2024-10-29  2:30 ` Greg KH
2024-10-29  6:28   ` 答复: " Rex Nie
2024-10-29 15:28 ` Bjorn Andersson
2024-10-29 15:38   ` Bryan O'Donoghue
2024-10-30  2:27 ` [PATCH v2] usb: typec: qcom-pmic: init value of hdr_len/txbuf_len earlier Rex Nie
2024-10-30  8:39   ` Heikki Krogerus
2024-10-30 10:35     ` 答复: " Rex Nie
2024-10-30 10:32   ` [PATCH v3] " Rex Nie
2024-10-30 12:31     ` Bryan O'Donoghue
2024-10-30 13:19     ` Heikki Krogerus
2024-10-30 13:37       ` 答复: " Rex Nie
2024-10-30 13:36   ` [PATCH v4] " Rex Nie
2024-10-31 10:56     ` Heikki Krogerus
2024-11-01 15:45     ` Bjorn Andersson
2024-11-02 12:27       ` 答复: " Rex Nie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox