[PATCH v2] common/sfc: replace out of bounds condition with static_assert
Stephen Hemminger
stephen at networkplumber.org
Wed Feb 7 23:36:51 CET 2024
On Wed, 7 Feb 2024 19:10:37 +0000
Ferruh Yigit <ferruh.yigit at amd.com> wrote:
> ../drivers/common/sfc_efx/base/ef10_filter.c:1246:18: error: shift count
> >= width of type [-Werror,-Wshift-count-overflow]
> matches_count = MCDI_OUT_DWORD(req,
> ^~~~~~~~~~~~~~~~~~~
> ../drivers/common/sfc_efx/base/efx_mcdi.h:493:2: note: expanded from
> macro 'MCDI_OUT_DWORD'
> EFX_DWORD_FIELD(*MCDI_OUT2(_emr, efx_dword_t, _ofst), \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ../drivers/common/sfc_efx/base/efx_types.h:533:30: note: expanded from
> macro 'EFX_DWORD_FIELD'
> EFX_HIGH_BIT(_field)) & EFX_MASK32(_field))
> ^~~~~~~~~~~~~~~~~~
> ../drivers/common/sfc_efx/base/efx_types.h:145:23: note: expanded from
> macro 'EFX_MASK32'
> (((((uint32_t)1) << EFX_WIDTH(_field))) - 1))
None of this got changed by the patch. Looks like it would not compile
even without the patch on your version of clang.
More information about the dev
mailing list