RE: [PATCH 1/8] staging: rtl8723bs: replace RND4 with round_up()

David Laight
2020-10-04T10:01:30Z

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)