[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d195e3d5425c7b1e6d9c85ee3a6d9cafbf39fa6a.camel@perches.com>
Date: Tue, 16 Mar 2021 20:47:53 -0700
From: Joe Perches <joe@...ches.com>
To: Qiang Ma <maqianga@...ontech.com>, gregkh@...uxfoundation.org,
ross.schm.dev@...il.com, mhocko@...e.com,
john.oldman@...ehill.co.uk, longman@...hat.com,
matthew.v.deangelis@...il.com
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: rtl8723bs/core: add spaces between operators
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);
Powered by blists - more mailing lists