From patchwork Thu Sep 24 07:11:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Svensson X-Patchwork-Id: 7254181 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 9A63B9F39B for ; Thu, 24 Sep 2015 07:11:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B40DC2082F for ; Thu, 24 Sep 2015 07:11:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6B8A20813 for ; Thu, 24 Sep 2015 07:11:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756860AbbIXHLn (ORCPT ); Thu, 24 Sep 2015 03:11:43 -0400 Received: from jptorel01.sonyericsson.com ([124.215.201.70]:4033 "EHLO jptorel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753549AbbIXHLl (ORCPT ); Thu, 24 Sep 2015 03:11:41 -0400 From: Lars Svensson To: CC: , , , , , , , , , Lars Svensson , Lars Svensson Subject: [PATCH V2] staging: rtl8723au: Remove unneeded endianness conversions Date: Thu, 24 Sep 2015 09:11:12 +0200 Message-ID: <1443078672-23970-1-git-send-email-lars1.svensson@sonymobile.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <20150923101109.GA1107@sonymobile.com> References: <20150923101109.GA1107@sonymobile.com> 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=-6.9 required=5.0 tests=BAYES_00, 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 in rtw_security.c. When checking crc, both actual and expected value was converted to cpu endianness before comparing, causing sparse warnings as below. Since the values are read from the buffer in correct byte order the extra conversions should not be needed. Thanks to Larry Finger for help sorting this out. 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 Acked-by: Larry Finger --- Patch V2: Reworked as adviced. --- drivers/staging/rtl8723au/core/rtw_security.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c index 3d40bab..a44c606 100644 --- a/drivers/staging/rtl8723au/core/rtw_security.c +++ b/drivers/staging/rtl8723au/core/rtw_security.c @@ -245,8 +245,8 @@ 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])); + actual_crc = getcrc32(payload, length - 4); + expected_crc = get_unaligned_le32(&payload[length - 4]); if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_, @@ -772,9 +772,8 @@ 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])); + actual_crc = getcrc32(payload, length - 4); + expected_crc = get_unaligned_le32(&payload[length - 4]); if (actual_crc != expected_crc) { RT_TRACE(_module_rtl871x_security_c_, _drv_err_,