RE: [PATCH v2 3/5] staging: r8188eu: use round_up() instead of _RND8()

From: David Laight
Date: Thu Apr 07 2022 - 04:36:58 EST


From: Michael Straube
> Sent: 06 April 2022 18:22
>
> Use in-kernel round_up() instead of custom _RND8().
...
> diff --git a/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
> b/drivers/staging/r8188eu/hal/rtl8188eu_xmit.c
...
> @@ -488,7 +488,7 @@ bool rtl8188eu_xmitframe_complete(struct adapter *adapt, struct xmit_priv *pxmit
>
> len = xmitframe_need_length(pxmitframe) + TXDESC_SIZE + (pxmitframe->pkt_offset *
> PACKET_OFFSET_SZ);
>
> - if (_RND8(pbuf + len) > MAX_XMITBUF_SZ) {
> + if (round_up(pbuf + len, 8) > MAX_XMITBUF_SZ) {

It can't be necessary to round_up there.
It is equivalent to:
if (pbuf + len > (MAX_XMITBUF_SZ & ~7))
and the limit is/should be a multiple of 8.

David

> pxmitframe->agg_num = 1;
> pxmitframe->pkt_offset = 1;
> break;

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)