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] [day] [month] [year] [list]
Message-ID: <ZG3nLDeJQQTq9W2z@kuha.fi.intel.com>
Date:   Wed, 24 May 2023 13:30:04 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Min-Hua Chen <minhuadotchen@...il.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: correctly access opcode

On Wed, May 24, 2023 at 12:23:12AM +0800, Min-Hua Chen wrote:
> hdr->opcode is __le32 type, use le32_to_cpu() to cast opcode
> to integer in the switch..case statement to fix the following
> sparse warnings:
> 
> drivers/usb/typec/ucsi/ucsi_glink.c:248:20: sparse: warning: restricted __le32 degrades to integer
> drivers/usb/typec/ucsi/ucsi_glink.c:248:20: sparse: warning: restricted __le32 degrades to integer
> drivers/usb/typec/ucsi/ucsi_glink.c:248:20: sparse: warning: restricted __le32 degrades to integer
> 
> No functional change.
> 
> Signed-off-by: Min-Hua Chen <minhuadotchen@...il.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
>  drivers/usb/typec/ucsi/ucsi_glink.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index b454a5159896..1fe9cb5b6bd9 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -245,7 +245,7 @@ static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
>  	struct pmic_glink_ucsi *ucsi = priv;
>  	const struct pmic_glink_hdr *hdr = data;
>  
> -	switch (hdr->opcode) {
> +	switch (le32_to_cpu(hdr->opcode)) {
>  	case UC_UCSI_READ_BUF_REQ:
>  		pmic_glink_ucsi_read_ack(ucsi, data, len);
>  		break;
> -- 
> 2.34.1

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ