Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp118528pxj; Thu, 3 Jun 2021 02:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWaxi8IENTney3+v4xWA/h7uOsNdWjAsK+TbI9ZCeyu5Ucx0V/cFxwrJ1CsyFN/xeOoCLh X-Received: by 2002:a17:906:95c8:: with SMTP id n8mr31304784ejy.357.1622712015990; Thu, 03 Jun 2021 02:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622712015; cv=none; d=google.com; s=arc-20160816; b=pUXunbjdGNpjVrt1X820XABsgIe92wx1TlJle4eYFT+VQhHwGugK3jMImwf1KjmkC4 mCK5HrnaV9nS7lVnOCcMt+yR1riBmkzBnZRjiiwOpSY6LQuBAy1XeZQotX5/uoadvheH qB/69kJr19UtHrZeSO0/7c5DeofYMWNfnM0zwxggitZyHlVbqi3Emz0g4WfGtp97GrVS En7Maun3Kg1vMAfLYCfo+y/RzHZh2Si16ONwTzxvoPzLCSN1WDQo0w6zeOc/p7OSNqeP odlC4ytxbkON0B4UEiQ2R9I8oL9xsr7WQKnWaYiso6QJ2nwMOo8ogZbqOp4WtLC1LZV4 qeKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6oUCEi/aWYxSv+2/Ciy1JQTFs/dwAaw5tTDmovb5vLs=; b=Rk+LbBxAtTnT4mCaw2kNLiSNSauNJ4pVKbK7pFL4zOWiNd1ceZa2x0pbdqQfOpWcK+ stFI82SnNMsStB8LI/vL9BGDkjC5kEY2KRfNiDZqs37SYJUBv7i9u7wip6GNtiUlledj qL1arvnCHchKpXEieivePIMqy9reqB1K3fyNdzH9NAIo28cpsJu4EvH4MMKTqNpkDWIA T1y9oEd+S1RUEHhA7eIztrj9YWcdT1mExuY+xSzVY9xccYC6l27Kdk7lCa1c2mFr4e97 MZoR6joL0ci1x0A5HAW3cL+5O34SEWDzc6JlQhAuFajOOZIGufJoziCvkJlJYKM+E5VU ring== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=I7f4gM7G; 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 j3si1863329ejv.180.2021.06.03.02.19.53; Thu, 03 Jun 2021 02:20:15 -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=I7f4gM7G; 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 S229738AbhFCJTz (ORCPT + 99 others); Thu, 3 Jun 2021 05:19:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:33560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbhFCJTy (ORCPT ); Thu, 3 Jun 2021 05:19:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 85CCA613B1; Thu, 3 Jun 2021 09:18:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622711890; bh=WqviaEw0MhFnTIUiBpw9FNDr4EIuI8nWVOUPL+95mXA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I7f4gM7GCEjZS6LKqPXsf0wIuLgS+ELxRJRwFwN9HEY42VlPVtvIvGOjutKRoIV7l F0K2tSZ9t2ptxpokANes81IHcQSKplrzqOD1bojZ/s4Qfzq36wo2x5XE1P5ylscG6n SO4ly2QA5z8G3SE/4/wi1TRM3mHsQOgXyqxvEGd4= Date: Thu, 3 Jun 2021 11:18:07 +0200 From: Greg Kroah-Hartman To: Wan Jiabing Cc: Fabio Aiuto , Ross Schmidt , Qiang Ma , Marco Cesati , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8723bs: core: fix some incorrect type warnings Message-ID: References: <1622708703-8561-1-git-send-email-wanjiabing@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1622708703-8561-1-git-send-email-wanjiabing@vivo.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 03, 2021 at 04:24:59PM +0800, Wan Jiabing wrote: > Fix some "incorrect type in assignment" in rtw_security.c. > > The sparse warings: > drivers/staging//rtl8723bs/core/rtw_security.c:72:50: warning: incorrect type in assignment > drivers/staging//rtl8723bs/core/rtw_security.c:72:50: expected restricted __le32 [usertype] > drivers/staging//rtl8723bs/core/rtw_security.c:72:50: got unsigned int > drivers/staging//rtl8723bs/core/rtw_security.c:80:50: warning: incorrect type in assignment > drivers/staging//rtl8723bs/core/rtw_security.c:80:50: expected restricted __le32 [usertype] > drivers/staging//rtl8723bs/core/rtw_security.c:80:50: got unsigned int > drivers/staging//rtl8723bs/core/rtw_security.c:124:33: warning: cast to restricted __le32 > drivers/staging//rtl8723bs/core/rtw_security.c:509:58: warning: incorrect type in assignment > drivers/staging//rtl8723bs/core/rtw_security.c:509:58: expected restricted __le32 [usertype] > drivers/staging//rtl8723bs/core/rtw_security.c:509:58: got unsigned int > drivers/staging//rtl8723bs/core/rtw_security.c:517:58: warning: incorrect type in assignment > drivers/staging//rtl8723bs/core/rtw_security.c:517:58: expected restricted __le32 [usertype] > drivers/staging//rtl8723bs/core/rtw_security.c:517:58: got unsigned int > drivers/staging//rtl8723bs/core/rtw_security.c:621:41: warning: cast to restricted __le32 > > Signed-off-by: Wan Jiabing > --- > drivers/staging/rtl8723bs/core/rtw_security.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c > index a99f439..4760999 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_security.c > +++ b/drivers/staging/rtl8723bs/core/rtw_security.c > @@ -36,7 +36,7 @@ const char *security_type_str(u8 value) > void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) > { /* exclude ICV */ > > - unsigned char crc[4]; > + u8 crc[4]; Why change this? > > signed int curfragnum, length; > u32 keylength; > @@ -69,7 +69,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) > > length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len; > > - *((__le32 *)crc) = ~crc32_le(~0, payload, length); > + *((__le32 *)crc) = cpu_to_le32(~crc32_le(~0, payload, length)); Are you sure this does what you think it does? What exactly is this doing now? > > arc4_setkey(ctx, wepkey, 3 + keylength); > arc4_crypt(ctx, payload, payload, length); > @@ -77,7 +77,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) > > } else { > length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len; > - *((__le32 *)crc) = ~crc32_le(~0, payload, length); > + *((__le32 *)crc) = cpu_to_le32(~crc32_le(~0, payload, length)); > arc4_setkey(ctx, wepkey, 3 + keylength); > arc4_crypt(ctx, payload, payload, length); > arc4_crypt(ctx, payload + length, crc, 4); > @@ -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)); > + *((__le32 *)crc) = cpu_to_le32(~crc32_le(~0, payload, length - 4)); This odd casting feels wrong, why is it correct now? thanks, greg k-h