From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66744C4363C for ; Sun, 4 Oct 2020 10:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 119DF20735 for ; Sun, 4 Oct 2020 10:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726012AbgJDKB3 convert rfc822-to-8bit (ORCPT ); Sun, 4 Oct 2020 06:01:29 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:41028 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbgJDKB2 (ORCPT ); Sun, 4 Oct 2020 06:01:28 -0400 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-261-Ghl-Rsi1Paaf30webE8vMA-1; Sun, 04 Oct 2020 11:01:23 +0100 X-MC-Unique: Ghl-Rsi1Paaf30webE8vMA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Sun, 4 Oct 2020 11:01:23 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Sun, 4 Oct 2020 11:01:23 +0100 From: David Laight To: 'Ross Schmidt' , "gregkh@linuxfoundation.org" CC: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/8] staging: rtl8723bs: replace RND4 with round_up() Thread-Topic: [PATCH 1/8] staging: rtl8723bs: replace RND4 with round_up() Thread-Index: AQHWmew0DoS2fLKzG0OejM3ZccTfWamHNZkg Date: Sun, 4 Oct 2020 10:01:23 +0000 Message-ID: <4f67bdfee5d74096b4ea0e92524e4951@AcuMS.aculab.com> References: <20201004011743.10750-1-ross.schm.dev@gmail.com> In-Reply-To: <20201004011743.10750-1-ross.schm.dev@gmail.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ross Schmidt > Sent: 04 October 2020 02:18 > > Use round_up instead of define RND4. RND4 was also particularly horrid! ... > diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c > b/drivers/staging/rtl8723bs/core/rtw_security.c > index 7f74e1d05b3a..159d32ace2bc 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_security.c > +++ b/drivers/staging/rtl8723bs/core/rtw_security.c > @@ -260,7 +260,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) > arcfour_encrypt(&mycontext, payload+length, crc, 4); > > pframe += pxmitpriv->frag_len; > - pframe = (u8 *)RND4((SIZE_PTR)(pframe)); > + pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4); I also suspect this is equivalent to: pframe == round_up(pxmitpriv->frag_len, 4); Does make one wonder whether the skipped bytes need to be zeroed though. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_40, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B8B6C4363C for ; Sun, 4 Oct 2020 10:01:35 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 218D0206C1 for ; Sun, 4 Oct 2020 10:01:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 218D0206C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=ACULAB.COM Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 79872203DC; Sun, 4 Oct 2020 10:01:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9fk8MTnaQxXk; Sun, 4 Oct 2020 10:01:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 65B9320392; Sun, 4 Oct 2020 10:01:32 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id EDD261BF338 for ; Sun, 4 Oct 2020 10:01:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E7EF886061 for ; Sun, 4 Oct 2020 10:01:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Aw1SDiHRW4bW for ; Sun, 4 Oct 2020 10:01:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by whitealder.osuosl.org (Postfix) with ESMTPS id 962D485CF0 for ; Sun, 4 Oct 2020 10:01:28 +0000 (UTC) Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-261-Ghl-Rsi1Paaf30webE8vMA-1; Sun, 04 Oct 2020 11:01:23 +0100 X-MC-Unique: Ghl-Rsi1Paaf30webE8vMA-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Sun, 4 Oct 2020 11:01:23 +0100 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Sun, 4 Oct 2020 11:01:23 +0100 From: David Laight To: 'Ross Schmidt' , "gregkh@linuxfoundation.org" Subject: RE: [PATCH 1/8] staging: rtl8723bs: replace RND4 with round_up() Thread-Topic: [PATCH 1/8] staging: rtl8723bs: replace RND4 with round_up() Thread-Index: AQHWmew0DoS2fLKzG0OejM3ZccTfWamHNZkg Date: Sun, 4 Oct 2020 10:01:23 +0000 Message-ID: <4f67bdfee5d74096b4ea0e92524e4951@AcuMS.aculab.com> References: <20201004011743.10750-1-ross.schm.dev@gmail.com> In-Reply-To: <20201004011743.10750-1-ross.schm.dev@gmail.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" From: Ross Schmidt > Sent: 04 October 2020 02:18 > > Use round_up instead of define RND4. RND4 was also particularly horrid! ... > diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c > b/drivers/staging/rtl8723bs/core/rtw_security.c > index 7f74e1d05b3a..159d32ace2bc 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_security.c > +++ b/drivers/staging/rtl8723bs/core/rtw_security.c > @@ -260,7 +260,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) > arcfour_encrypt(&mycontext, payload+length, crc, 4); > > pframe += pxmitpriv->frag_len; > - pframe = (u8 *)RND4((SIZE_PTR)(pframe)); > + pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4); I also suspect this is equivalent to: pframe == round_up(pxmitpriv->frag_len, 4); Does make one wonder whether the skipped bytes need to be zeroed though. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel