Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1997952pxj; Sun, 13 Jun 2021 05:32:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJDDcXwjNjCg40p8B94kQLyRuiyASp0rFGQS2SdZeZNXplQWvguOD3eB3BjWdKs1FHgimi X-Received: by 2002:a50:cb8a:: with SMTP id k10mr12605238edi.267.1623587539960; Sun, 13 Jun 2021 05:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623587539; cv=none; d=google.com; s=arc-20160816; b=BxdtYnhYAncEGz59aNnyksgV9Hu5N4BIqw/Va1GzeKINpz230GwgSDIOq6abDH3w7s vpLx/TH3k80tQhMFGS3BY6Ef8vc6kFjoPgh9BcRYVKuVcL9LUDW2oZhJV8oS6dB3Xg2I /wHDoP7Zr9OWRPjgcsu9ydOTXwIWZ/CsMhokByTghn4FHWwAnFh+SktesBMk2I35SpqX Ih3YPFxUktAgTBp8plsIk6Di7q08QVj+y7tjbCZRgPgjiTOz93k1j8hq0iqqXZWBWt3S f9IgfDx2u/Tn8Ao8a4/xduN8INeZ02jji1b9USYH+cWqThu9vqUJnurLGrcNCR1On4Mm cYnw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=YVyb5GJd1/eOOTzVnEFYfGEHURKljx+p9YMnSFodCUw=; b=hpD10qWcAKHZACkDVbFyzwfgtABLYYu7lleSIriQz1G5dPEOLLCzCxQWr8ZeBfSS73 4xY6zPKrD6b7l9uBqTAYPYYb+t/KpdTBUJL60Wy4KUsOCAt9pYrjsLV+tO4LZtWcDjjy 4PIp/CbybZG+qkrU3zun5fuJmrc7MDkGsBNL1nHQ/r0wkGDGWZR7u9qj5tfTAf6VG1sB 0qz1r3TJXmoAWpaw5fv4wxNqKcLjxXm2ea5fXzjEBJ0AaC0dlwA51xzfsvhfQG/KvwbZ dlNAdGI+DaTMO09JZDZZ4zYJRoT5VNETOiykpk5RnzxAD0bAGNwggVGdQDXm9FHd35FQ IRBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OXW0VIQr; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz5si8723512ejc.12.2021.06.13.05.31.56; Sun, 13 Jun 2021 05:32:19 -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=@gmail.com header.s=20161025 header.b=OXW0VIQr; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231788AbhFMMbI (ORCPT + 99 others); Sun, 13 Jun 2021 08:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231773AbhFMMbH (ORCPT ); Sun, 13 Jun 2021 08:31:07 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84CD7C061574 for ; Sun, 13 Jun 2021 05:29:06 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id k22-20020a17090aef16b0290163512accedso9192932pjz.0 for ; Sun, 13 Jun 2021 05:29:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YVyb5GJd1/eOOTzVnEFYfGEHURKljx+p9YMnSFodCUw=; b=OXW0VIQrWkWFSxR1BBI+69VwFZ3jzmEoUd4MBJ2+0cGcsznqOhekZfbDPVKUcO8pm5 F3wMyfCHDQkY62k3vmHGDB23xeo0epPsaUwPs6FkhZq/r/6ELe5R5uTonKVjXFoWeBsH Oq+p9q1dRGv+TMXTX4yV6o5uzDHPTKsK8OdPDqGHZYr9V9u7wXL7kSN3tuiWxI9bFwgY nQPuYp+ylGg0Da/J7u0xDKlg3dsHKLFBWDJGycbVA/RTQ1/aWcrari3dv7ifFnzsRkKB Gtlyn7aK4tWSTkF6uMAlYhesBtnHuxKyYVBynuLOn0bPLU95R4hwPLnCrWzLZzC+Z/3n cSsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YVyb5GJd1/eOOTzVnEFYfGEHURKljx+p9YMnSFodCUw=; b=SKXwAJtB8f2BqHth/wlFLbFZjBFSY2EGG60YVsND0PGQa2JCZLdsapTtmtvrOJH4xj O25x8YTs1R1QHHWo8VVzoLH0OlB2msEwj5hmv9G5U3hrpuZMBumKnibMUUf17xryPGrJ oR2s02lYRsSOPpJdftZi+uZpbL1VfAO1jFi+3OTGAlRna0Vad94jbmGJpGQwkHzvDOLE nvpUE/UJ09NwLKN50gT2lmU80coFppPt60o+PL713QEc73BXFrNqeovTKe+qZUxqBNbn nVnWDnKa0CC0fBmTZ1dZU/QhVo/mGjMOnhBt6SBRJnSeN9SXFiQ+6LqGWihwusXHiOrG ETTA== X-Gm-Message-State: AOAM530JVd0MUh2QZNwul9YS20OlY3zLPBShbWm20UjpdjQS1sXnWTic OKHuypmFl4XS58MNUJysWGlzAsvRc+Vgzo68 X-Received: by 2002:a17:902:a70f:b029:ea:d4a8:6a84 with SMTP id w15-20020a170902a70fb02900ead4a86a84mr12431881plq.42.1623587345706; Sun, 13 Jun 2021 05:29:05 -0700 (PDT) Received: from jm.lan (1-171-209-173.dynamic-ip.hinet.net. [1.171.209.173]) by smtp.gmail.com with ESMTPSA id l12sm555022pff.105.2021.06.13.05.29.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Jun 2021 05:29:05 -0700 (PDT) From: Jhih-Ming Huang To: gregkh@linuxfoundation.org, fabioaiuto83@gmail.com, ross.schm.dev@gmail.com, maqianga@uniontech.com, marcocesati@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Jhih-Ming Huang Subject: [PATCH v2] rtw_security: fix cast to restricted __le32 Date: Sun, 13 Jun 2021 20:28:58 +0800 Message-Id: <20210613122858.1433252-1-fbihjmeric@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes the sparse warning of fix cast to restricted __le32. Last month, there was a change for replacing private CRC-32 routines with in-kernel ones. In that patch, we replaced getcrc32 with crc32_le in calling le32_to_cpu. le32_to_cpu accepts __le32 type as arg, but crc32_le returns unsigned int. That how it introduced the sparse warning. This patch uses __force to fix the warning. Signed-off-by: Jhih-Ming Huang --- drivers/staging/rtl8723bs/core/rtw_security.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index a99f439328f1..2f4da67e31c6 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -121,7 +121,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) arc4_crypt(ctx, payload, payload, length); /* calculate icv and compare the icv */ - *((u32 *)crc) = le32_to_cpu(~crc32_le(~0, payload, length - 4)); + *((u32 *)crc) = le32_to_cpu((__force __le32)~crc32_le(~0, payload, length - 4)); } } @@ -618,7 +618,8 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) arc4_setkey(ctx, rc4key, 16); arc4_crypt(ctx, payload, payload, length); - *((u32 *)crc) = le32_to_cpu(~crc32_le(~0, payload, length - 4)); + *((u32 *)crc) = le32_to_cpu((__force __le32)~crc32_le(~0, payload, + length - 4)); if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] || crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) -- 2.25.1