mbox series

[0/3] net/sfc: fix power of 2 alignment macros

Message ID 1563973146-16577-1-git-send-email-arybchenko@solarflare.com (mailing list archive)
Headers
Series net/sfc: fix power of 2 alignment macros |

Message

Andrew Rybchenko July 24, 2019, 12:59 p.m. UTC
  P2ROUNDUP() and P2ALIGN() macros are buggy when alignment type is smaller
than type of the value to be aligned.

IS_P2ALIGNED() has no the problem since it cast its arugments
to uintptr_t inside, but fixed anyway to follow the same approach as
new EFX_P2ROUNDUP() and EFX_P2ALIGN().

Patches have checkpatches.sh warnings in base driver since space
is required after sizeof.

Andrew Rybchenko (3):
  net/sfc: fix power of 2 round up when align has smaller type
  net/sfc: fix align to power of 2 when align has smaller type
  net/sfc: unify power of 2 alignment check macro

 drivers/net/sfc/base/ef10_impl.h  |  9 +++---
 drivers/net/sfc/base/ef10_nvram.c |  3 +-
 drivers/net/sfc/base/ef10_rx.c    | 11 ++++---
 drivers/net/sfc/base/efx.h        | 21 ++++++++++---
 drivers/net/sfc/base/efx_mcdi.h   |  9 ++++--
 drivers/net/sfc/base/efx_tx.c     |  4 +--
 drivers/net/sfc/efsys.h           | 51 +++++++++++++++----------------
 drivers/net/sfc/sfc_ethdev.c      |  2 +-
 drivers/net/sfc/sfc_rx.c          |  2 +-
 9 files changed, 64 insertions(+), 48 deletions(-)
  

Comments

Andrew Rybchenko July 24, 2019, 1:04 p.m. UTC | #1
On 7/24/19 3:59 PM, Andrew Rybchenko wrote:
> P2ROUNDUP() and P2ALIGN() macros are buggy when alignment type is smaller
> than type of the value to be aligned.
>
> IS_P2ALIGNED() has no the problem since it cast its arugments
> to uintptr_t inside, but fixed anyway to follow the same approach as
> new EFX_P2ROUNDUP() and EFX_P2ALIGN().
>
> Patches have checkpatches.sh warnings in base driver since space
> is required after sizeof.
>
> Andrew Rybchenko (3):
>    net/sfc: fix power of 2 round up when align has smaller type
>    net/sfc: fix align to power of 2 when align has smaller type
>    net/sfc: unify power of 2 alignment check macro
>
>   drivers/net/sfc/base/ef10_impl.h  |  9 +++---
>   drivers/net/sfc/base/ef10_nvram.c |  3 +-
>   drivers/net/sfc/base/ef10_rx.c    | 11 ++++---
>   drivers/net/sfc/base/efx.h        | 21 ++++++++++---
>   drivers/net/sfc/base/efx_mcdi.h   |  9 ++++--
>   drivers/net/sfc/base/efx_tx.c     |  4 +--
>   drivers/net/sfc/efsys.h           | 51 +++++++++++++++----------------
>   drivers/net/sfc/sfc_ethdev.c      |  2 +-
>   drivers/net/sfc/sfc_rx.c          |  2 +-
>   9 files changed, 64 insertions(+), 48 deletions(-)
>

Self NACK since the second patch fixes the first one. I'll send v2 shortly.