[PATCH] mempool/cnxk: fix halo enable devarg parsing
Stephen Hemminger
stephen at networkplumber.org
Fri Oct 30 17:30:48 CET 2026
one more reason to have common code for boolean flags. there is a bigish
series to do that
On Thu, Oct 29, 2026, 22:17 Nawal Kishor <nkishor at marvell.com> wrote:
> parse_halo_ena_handler() kept the parsed value in a uint8_t and stored
> it through a uint8_t pointer, while the caller passes a uint32_t. The
> narrowing happened before the 0/1 check, so 256 was accepted as 0 and
> 257 as 1. The one-byte store also updated only the first byte of that
> uint32_t, which is correct only on a little-endian host when the local
> is already zero.
>
> Parse and store a uint32_t so the check sees the full value and the
> caller's object is written completely.
>
> Fixes: 45abbfc836b1 ("mempool/cnxk: support HALO in mempool")
>
> Signed-off-by: Nawal Kishor <nkishor at marvell.com>
> ---
> drivers/mempool/cnxk/cnxk_mempool.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mempool/cnxk/cnxk_mempool.c
> b/drivers/mempool/cnxk/cnxk_mempool.c
> index 6939fccff4..f1cdf9cbb5 100644
> --- a/drivers/mempool/cnxk/cnxk_mempool.c
> +++ b/drivers/mempool/cnxk/cnxk_mempool.c
> @@ -51,13 +51,13 @@ static int
> parse_halo_ena_handler(const char *key, const char *value, void
> *extra_args)
> {
> RTE_SET_USED(key);
> - uint8_t val;
> + uint32_t val;
>
> val = atoi(value);
> if (val != 0 && val != 1)
> return -EINVAL;
>
> - *(uint8_t *)extra_args = val;
> + *(uint32_t *)extra_args = val;
> return 0;
> }
>
> --
> 2.48.1
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20261030/94cc5408/attachment.htm>
More information about the dev
mailing list