From patchwork Thu Oct 5 12:05:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9986961 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2538B602B8 for ; Thu, 5 Oct 2017 12:06:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10DA428C2A for ; Thu, 5 Oct 2017 12:06:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05B3F28C6E; Thu, 5 Oct 2017 12:06:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99FE428C2A for ; Thu, 5 Oct 2017 12:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751330AbdJEMGF (ORCPT ); Thu, 5 Oct 2017 08:06:05 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:51986 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751239AbdJEMGD (ORCPT ); Thu, 5 Oct 2017 08:06:03 -0400 Received: from wuerfel.lan ([95.208.190.237]) by mrelayeu.kundenserver.de (mreue105 [212.227.15.145]) with ESMTPA (Nemesis) id 0LxwHc-1dCm9D23rY-015Kxe; Thu, 05 Oct 2017 14:05:51 +0200 From: Arnd Bergmann To: Kalle Valo , Prameela Rani Garnepudi , Amitkumar Karwar Cc: Arnd Bergmann , Pavani Muthyala , Karun Eagalapati , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rsi: fix integer overflow warning Date: Thu, 5 Oct 2017 14:05:24 +0200 Message-Id: <20171005120547.328687-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:wy546/RtpqqJuYSYxkpvQ9rj1lHXYw9iNWjwthWlLnziJPUapte WXvLKU79vWMXTmFrYpRk6CE3O+km9UHn3QkTjz3ZO6D5eAZ9PU5EYNzgU/cl4aNqIKOTP5E k1qIm6UajiCilX0RwgadvnRTVyXcAKj63jNcWacFBFvqFIqLSPica0uwMVMEe8tqgjG2eJH 9KDG5DmM+0ZyrlSEVgFBA== X-UI-Out-Filterresults: notjunk:1; V01:K0:pFsLIIDpePY=:fnpnwq92FdgWLv1W57W4R9 DG3Hw2NZhbOw4MPDGSrxsD/CSjFFEsJ2gtVnwExJX4xmZvBef5tHz01xsVS9rahjABULp7G20 906PHjlpcPzRstl6RV9sKuSyWcJw0b/mCQ9a/Zo42QGdULbcbyiqr2qhqjEaMLx5QzL0VuDiM 8LfmpZcWwqCXadrua2CKWaIA/FiCae2Y9AVsW13PEZXuq8lHFOS9dAHohNB7qzmygWlC9QLQv t/b1UMXlGjh4Vf7Yj1p0OkkwhjA+T0UGBvJthRDfgEI0hkeC1lwVcQQDlX2q9H/BCyQ4Oaml6 oqr4xt2NVkvCXdEgEyVbMzzejz2LfAuKnj+FGtQ1IEjO06uwem8D13f45Iss29neb4E8OdXy9 ONVV0ypVi7vU9FX8huHe8HDVDrCpQrxECeulaZU+LE6pzivhk9I4F/3XTNWeIXYLXXBV5To/M 25dOTuPVauFhMqmsyWXyFCZzMx8V1/jMmMaNybVG0aD/K0o668rQp5v53a198rZKbni4+ytpm sGGDsL3rEzFZj71bOGAs82eBbRMS1fRPN7ZOONsN+0868dnXx0enrYkmyEAuLIsAUopcnCywx jJRbjbk9eb7g/cjOu8/AKvWqNIgMrx1XJQPBbuAxLKx2BhzzaD/GZkZksS3/kyVVfiXsIeSox +V0Sa3oQYVDWbtAPqMdg4H8FNuoLPntCyexQePx4CymtAJte48hIf68ehNjJ5FgpGKAE3SRnM cE+TvO3QabdUv3iSIjDIGslSSU6Rc5KduTdXiw== Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP gcc produces a harmless warning about a recently introduced signed integer overflow: drivers/net/wireless/rsi/rsi_91x_hal.c: In function 'rsi_prepare_mgmt_desc': include/uapi/linux/swab.h:13:15: error: integer overflow in expression [-Werror=overflow] (((__u16)(x) & (__u16)0x00ffU) << 8) | \ ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ include/uapi/linux/swab.h:104:2: note: in expansion of macro '___constant_swab16' ___constant_swab16(x) : \ ^~~~~~~~~~~~~~~~~~ include/uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16' #define __cpu_to_le16(x) ((__force __le16)__swab16((x))) ^~~~~~~~ include/linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16' #define cpu_to_le16 __cpu_to_le16 ^~~~~~~~~~~~~ drivers/net/wireless/rsi/rsi_91x_hal.c:136:3: note: in expansion of macro 'cpu_to_le16' cpu_to_le16((tx_params->vap_id << RSI_DESC_VAP_ID_OFST) & ^~~~~~~~~~~ The problem is that the 'mask' value is a signed integer that gets turned into a negative number when truncated to 16 bits. Making it an unsigned constant avoids this. Fixes: eac4eed3224b ("rsi: tx and rx path enhancements for p2p mode") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/rsi/rsi_mgmt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/rsi/rsi_mgmt.h b/drivers/net/wireless/rsi/rsi_mgmt.h index b9d0802c1b0f..e21723013f8d 100644 --- a/drivers/net/wireless/rsi/rsi_mgmt.h +++ b/drivers/net/wireless/rsi/rsi_mgmt.h @@ -189,7 +189,7 @@ IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \ IEEE80211_WMM_IE_STA_QOSINFO_AC_BK) -#define RSI_DESC_VAP_ID_MASK 0xC000 +#define RSI_DESC_VAP_ID_MASK 0xC000u #define RSI_DESC_VAP_ID_OFST 14 #define RSI_DATA_DESC_MAC_BBP_INFO BIT(0) #define RSI_DATA_DESC_NO_ACK_IND BIT(9)