From patchwork Tue Sep 22 07:24:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Svensson X-Patchwork-Id: 7239281 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 683E99F372 for ; Tue, 22 Sep 2015 13:57:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 87E2C20701 for ; Tue, 22 Sep 2015 13:57:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8A24A206F3 for ; Tue, 22 Sep 2015 13:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933516AbbIVN4t (ORCPT ); Tue, 22 Sep 2015 09:56:49 -0400 Received: from seldrel01.sonyericsson.com ([37.139.156.2]:11839 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757848AbbIVN4s (ORCPT ); Tue, 22 Sep 2015 09:56:48 -0400 From: Lars Svensson To: CC: , , , , , , , , , Lars Svensson , Lars Svensson Subject: [PATCH] staging: rtl8723au: Mark type casts to __le32 as intentional Date: Tue, 22 Sep 2015 09:24:01 +0200 Message-ID: <1442906641-22824-1-git-send-email-lars1.svensson@sonymobile.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixing Sparse warnings about intentional type casts in rtw_security.c as below. CHECK drivers/staging/rtl8723au/core/rtw_security.c drivers/staging/rtl8723au/core/rtw_security.c:248:22: \ warning: cast to restricted __le32 drivers/staging/rtl8723au/core/rtw_security.c:249:24: \ warning: cast to restricted __le32 drivers/staging/rtl8723au/core/rtw_security.c:776:22: \ warning: cast to restricted __le32 drivers/staging/rtl8723au/core/rtw_security.c:777:24: \ warning: cast to restricted __le32 Signed-off-by: Lars Svensson --- drivers/staging/rtl8723au/core/rtw_security.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 3d40bab..311dfc1 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -213,6 +213,7 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, { /* exclude ICV */ u32 actual_crc, expected_crc; + __le32 crc_le; struct arc4context mycontext; int length; u32 keylength; @@ -245,8 +246,10 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter, arcfour_encrypt(&mycontext, payload, payload, length); /* calculate icv and compare the icv */ - actual_crc = le32_to_cpu(getcrc32(payload, length - 4)); - expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4])); + crc_le = (__force __le32)getcrc32(payload, length - 4); + actual_crc = le32_to_cpu(crc_le); + crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]); + expected_crc = le32_to_cpu(crc_le); if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, @@ -717,6 +720,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, u8 rc4key[16]; u8 ttkey[16]; u32 actual_crc, expected_crc; + __le32 crc_le; struct arc4context mycontext; int length; u32 prwskeylen; @@ -772,9 +776,10 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter, /* 4 decrypt payload include icv */ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); - - actual_crc = le32_to_cpu(getcrc32(payload, length - 4)); - expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4])); + crc_le = (__force __le32)getcrc32(payload, length - 4); + actual_crc = le32_to_cpu(crc_le); + crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]); + expected_crc = le32_to_cpu(crc_le); if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_,