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: <000001dc3be8$62cf3370$286d9a50$@samsung.com>
Date: Mon, 13 Oct 2025 11:23:38 +0900
From: "Wonkon Kim" <wkon.kim@...sung.com>
To: "'Bart Van Assche'" <bvanassche@....org>,
	<James.Bottomley@...senPartnership.com>, <martin.petersen@...cle.com>,
	<peter.wang@...iatek.com>, <linux-scsi@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] ufs: core: Initialize a variable mode for PA_PWRMODE

> On 10/2/25 12:00 AM, Wonkon Kim wrote:
> >   static bool ufshcd_is_pwr_mode_restore_needed(struct ufs_hba *hba)
> >   {
> >   	struct ufs_pa_layer_attr *pwr_info = &hba->pwr_info;
> > -	u32 mode;
> > +	u32 mode = 0;
> >
> >   	ufshcd_dme_get(hba, UIC_ARG_MIB(PA_PWRMODE), &mode);
> 
> Since there is more code that passes a pointer to an uninitialized
> variable to ufshcd_dme_get(), the untested patch below may be a better
> solution:
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> 127b691402f9..5226fbca29ec 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -4277,8 +4277,8 @@ int ufshcd_dme_get_attr(struct ufs_hba *hba, u32
> attr_sel,
>   			get, UIC_GET_ATTR_ID(attr_sel),
>   			UFS_UIC_COMMAND_RETRIES - retries);
> 
> -	if (mib_val && !ret)
> -		*mib_val = uic_cmd.argument3;
> +	if (mib_val)
> +		*mib_val = ret == 0 ? uic_cmd.argument3 : 0;
> 
>   	if (peer && (hba->quirks & UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE)
>   	    && pwr_mode_change)
> 
> 

Sorry for late reply.
Ok, I agree with you and it would be more general.
There is a code to initialize a variable.
Do you think it also needs to fix?

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index a4438a3cb73a..d593ff7ea63d 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4990,7 +4990,7 @@ EXPORT_SYMBOL_GPL(ufshcd_hba_enable);
 
 static int ufshcd_disable_tx_lcc(struct ufs_hba *hba, bool peer)
 {
-       int tx_lanes = 0, i, err = 0;
+       int tx_lanes, i, err = 0;
 
        if (!peer)
		ufshcd_dme_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES),
			       &tx_lanes);
	else
		ufshcd_dme_peer_get(hba, UIC_ARG_MIB(PA_CONNECTEDTXDATALANES),
				    &tx_lanes);

Thanks,
Wonkon Kim.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ