From: Joe Perches <joe@perches.com>
To: Qiang Ma <maqianga@uniontech.com>,
gregkh@linuxfoundation.org, ross.schm.dev@gmail.com,
mhocko@suse.com, john.oldman@polehill.co.uk, longman@redhat.com,
matthew.v.deangelis@gmail.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs/core: add spaces between operators
Date: Tue, 16 Mar 2021 20:47:53 -0700 [thread overview]
Message-ID: <d195e3d5425c7b1e6d9c85ee3a6d9cafbf39fa6a.camel@perches.com> (raw)
In-Reply-To: <20210316120500.351-1-maqianga@uniontech.com>
On Tue, 2021-03-16 at 20:05 +0800, Qiang Ma wrote:
> Add spaces between operators for a better readability
> in function 'rtw_seccalctkipmic'.
Perhaps better would be to refactor it a bit to
follow the comments. Something like:
---
drivers/staging/rtl8723bs/core/rtw_security.c | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index a311595deafb..a30e1fa717af 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -405,30 +405,26 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst)
void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri)
{
-
struct mic_data micdata;
u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
+ int da_offset;
+ int sa_offset;
rtw_secmicsetkey(&micdata, key);
priority[0] = pri;
/* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */
- if (header[1]&1) { /* ToDS == 1 */
- rtw_secmicappend(&micdata, &header[16], 6); /* DA */
- if (header[1]&2) /* From Ds == 1 */
- rtw_secmicappend(&micdata, &header[24], 6);
- else
- rtw_secmicappend(&micdata, &header[10], 6);
- } else { /* ToDS == 0 */
- rtw_secmicappend(&micdata, &header[4], 6); /* DA */
- if (header[1]&2) /* From Ds == 1 */
- rtw_secmicappend(&micdata, &header[16], 6);
- else
- rtw_secmicappend(&micdata, &header[10], 6);
+ if (header[1] & 1) { /* ToDS == 1 */
+ da_offset = 16;
+ sa_offset = (header[1] & 2) ? 24 : 10;
+ } else { /* ToDS == 0 */
+ da_offset = 4;
+ sa_offset = (header[1] & 2) ? 16 : 10;
}
+ rtw_secmicappend(&micdata, &header[da_offset], 6); /* DA */
+ rtw_secmicappend(&micdata, &header[sa_offset], 6); /* SA */
rtw_secmicappend(&micdata, &priority[0], 4);
-
rtw_secmicappend(&micdata, data, data_len);
rtw_secgetmic(&micdata, mic_code);
prev parent reply other threads:[~2021-03-17 3:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 12:05 Qiang Ma
2021-03-17 3:47 ` Joe Perches [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d195e3d5425c7b1e6d9c85ee3a6d9cafbf39fa6a.camel@perches.com \
--to=joe@perches.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.oldman@polehill.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=maqianga@uniontech.com \
--cc=matthew.v.deangelis@gmail.com \
--cc=mhocko@suse.com \
--cc=ross.schm.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®