lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <q5vuljnuhhasjbexc2aphfd3bzykz3v43sx2bb7vu5h5zacb4y@gvzbthmmg6wj>
Date: Tue, 29 Oct 2024 10:28:55 -0500
From: Bjorn Andersson <andersson@...nel.org>
To: Rex Nie <rex.nie@...uarmicro.com>
Cc: bryan.odonoghue@...aro.org, heikki.krogerus@...ux.intel.com, 
	gregkh@...uxfoundation.org, linux-arm-msm@...r.kernel.org, linux-usb@...r.kernel.org, 
	linux-kernel@...r.kernel.org, angus.chen@...uarmicro.com
Subject: Re: [PATCH] usb: typec: qcom-pmic: fix uninitialized value hdr_len
 and txbuf_len

On Tue, Oct 29, 2024 at 10:18:23AM GMT, Rex Nie wrote:
> 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@...uarmicro.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;

This stops us from printing uninitialized values, but the error print is
now containing misleading/false data instead.

As far as I can tell, the assignment of these three variables depend
only on the  "msg" argument passed to the function, not on the
operations leading up to their assignment.

So how about just moving the 3 assignments up to the top of the function
instead?

Regards,
Bjorn

>  	unsigned long flags;
>  	int ret;
>  
> -- 
> 2.17.1
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ