Re: [PATCH 8/8] staging: rtl8188eu: use is_broadcast_ether_addr

From: Joe Perches
Date: Sun Jul 29 2018 - 13:22:27 EST


On Sun, 2018-07-29 at 19:08 +0200, Michael Straube wrote:
> Use is_broadcast_ether_addr instead of checking each byte of the
> address array for 0xff. Shortens the code and improves readability.

You should show in the commit log that sta_addr is __aligned(2)
as required by is_broadcast_ether_addr, otherwise you could be
introducing runtime alignment defects.

> diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
[]
> @@ -361,9 +361,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
> goto exit;
> }
>
> - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff &&
> - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff &&
> - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
> + if (is_broadcast_ether_addr(param->sta_addr)) {
> if (param->u.crypt.idx >= WEP_KEYS) {
> ret = -EINVAL;
> goto exit;

etc...