Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2735365pxj; Mon, 31 May 2021 09:25:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2SqcQbw4CaGMdMEJDdqg+h/BzUDj0LGp8c7pTDcLETIqtP+weUCDhXVOXNqfRetC15314 X-Received: by 2002:a05:6e02:12af:: with SMTP id f15mr15825186ilr.77.1622478303003; Mon, 31 May 2021 09:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622478302; cv=none; d=google.com; s=arc-20160816; b=MRAKQgSqyAqwYB6qtRZqfLabYTwkyd8TY5nord/Pr5LHxpo7Z+RWVSSng2p6OBNQGc 8V5462n+VerHMQlhuhylmvUNSGN7u74ehnLkCOkxJEuX/XSmDb7Z85+74u67yCfRoJy0 h7tdTt1bn5uCChEo6uhF2dQE9D18YeaSLy0nXwez7GZCjaY2UC3zAHJvEU3B7bqHKj/5 XhZ0JGU9NxqDmH9VpsLJbejxsfpb/Cks5PRTeDIPyCVP1a6rqP4ON1LCJmlnxnGF3InB D9cyNNT1QW0YK25qTRi+8Xo7Ps/s/TCCR3AqwnanB+jBAvwFF85hffq2mPRAxtt6V7O3 Xshw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZqSGtJWjt0HaUYIX97fZfvcbG/TT4kvkZxpJ9Rf9OE0=; b=LXg4iO4WGhxYgaZF74e+tRTRdNUUHWgAb+zhUrizz4C28IRXKXSM7hiWWaPuJ89Bks tXN7pI3LeUyhkChuytL0jMp7EMVv5h1PTTgdhfRoEx484hiEJZ1JrdmW3omML3hzP/VC r/NrczETx3+XkHn073JCSAhGwHPNv4jNiHspKWE+L2SBtxnvkghxdc3oev355eNnSAUv /zB5NQmKjbj7wkY/M1jozuLjIeztsuBPjblxajyaeGSt83KT5WXpbbc9eNpVGRWbyX32 2pdc9j+CP9Qsg9OhanEDUs5KM7FR3tBLfQ/yk+SC2P2upULOWkzhsVDeeD8VE5M1mobn ATYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wrDRBfmb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r133si6111188jac.80.2021.05.31.09.24.50; Mon, 31 May 2021 09:25:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wrDRBfmb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234699AbhEaQYY (ORCPT + 99 others); Mon, 31 May 2021 12:24:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:37862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233335AbhEaOlX (ORCPT ); Mon, 31 May 2021 10:41:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AD4C261C68; Mon, 31 May 2021 13:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469198; bh=xagvrzRcVIBO+CNLCyaW5UeI3FqC/1oW+yIpTa01+fk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wrDRBfmbs2vyRHqbWV//WwXLn8r79vKkjcSCAY+yB0tJZMYibG68m+DxkpPd51SA7 n/BtneM3eKIpFe3YCp8nhWZ320GToB3nH4PX7ckPoEUJsoCRBtO0+puy7lbf4FN3IG u1Z1zGXgz0DArdsHx3NVCBahoX3B02RePHwt8pFI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Thomson , Guenter Roeck , Heikki Krogerus , Andy Shevchenko Subject: [PATCH 5.12 107/296] usb: typec: tcpm: Use LE to CPU conversion when accessing msg->header Date: Mon, 31 May 2021 15:12:42 +0200 Message-Id: <20210531130707.537266142@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit c58bbe3477f75deb7883983e6cf428404a107555 upstream. Sparse is not happy about strict type handling: .../typec/tcpm/tcpm.c:2720:27: warning: restricted __le16 degrades to integer .../typec/tcpm/tcpm.c:2814:32: warning: restricted __le16 degrades to integer Fix this by converting LE to CPU before use. Fixes: ae8a2ca8a221 ("usb: typec: Group all TCPCI/TCPM code together") Fixes: 64f7c494a3c0 ("typec: tcpm: Add support for sink PPS related messages") Cc: stable Cc: Adam Thomson Reviewed-by: Guenter Roeck Reviewed-by: Adam Thomson Reviewed-by: Heikki Krogerus Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210519100358.64018-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/tcpm/tcpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -2697,7 +2697,7 @@ static void tcpm_pd_ext_msg_request(stru enum pd_ext_msg_type type = pd_header_type_le(msg->header); unsigned int data_size = pd_ext_header_data_size_le(msg->ext_msg.header); - if (!(msg->ext_msg.header & PD_EXT_HDR_CHUNKED)) { + if (!(le16_to_cpu(msg->ext_msg.header) & PD_EXT_HDR_CHUNKED)) { tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS); tcpm_log(port, "Unchunked extended messages unsupported"); return; @@ -2791,7 +2791,7 @@ static void tcpm_pd_rx_handler(struct kt "Data role mismatch, initiating error recovery"); tcpm_set_state(port, ERROR_RECOVERY, 0); } else { - if (msg->header & PD_HEADER_EXT_HDR) + if (le16_to_cpu(msg->header) & PD_HEADER_EXT_HDR) tcpm_pd_ext_msg_request(port, msg); else if (cnt) tcpm_pd_data_request(port, msg);