Re: [PATCH RFC] staging: ks7010: remove custom Michael MIC implementation
From: Joe Perches
Date: Fri Mar 31 2017 - 01:16:15 EST
On Fri, 2017-03-31 at 15:47 +1100, Tobin C. Harding wrote:
> ks7010 currently uses a custom implementation of the Michael MIC
> algorithm. The kernel has an implementation of this algorithm
> already, we should use it.
ok, trivia:
Do please run your patch through checkpatch and fix a few style nits.
$ ./scripts/checkpatch.pl ~/1.mbox --strict --terse | cut -f2- -d":"
161: WARNING: line over 80 characters
170: WARNING: Missing a blank line after declarations
205: WARNING: line over 80 characters
229: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
263: WARNING: Prefer using "%s", __func__ to embedded function names
264: ERROR: code indent should use tabs where possible
264: WARNING: quoted string split across lines
272: WARNING: Prefer using "%s", __func__ to embedded function names
273: ERROR: code indent should use tabs where possible
273: WARNING: quoted string split across lines
325: WARNING: Prefer pr_warn(... to pr_warning(...
2 errors, 9 warnings, 0 checks, 262 lines checked
and
> diff --git a/drivers/staging/ks7010/mic.c b/drivers/staging/ks7010/mic.c
[]
> +int ks_wlan_mic(struct crypto_shash *tfm_michael, u8 *key,
> + u8 priority, u8 *data, size_t data_len, u8 *mic)
> +{
> + SHASH_DESC_ON_STACK(desc, tfm_michael);
> + u8 hdr[ETH_HLEN + 2]; /* 16 bytes */
It might be better to declare a struct for this
> + hdr[ETH_ALEN * 2] = priority;
> + hdr[ETH_ALEN * 2 + 1] = 0;
> + hdr[ETH_ALEN * 2 + 2] = 0;
> + hdr[ETH_ALEN * 2 + 3] = 0;
And use struct members here.