mempool/cnxk: fix halo enable devarg parsing
PATCH 1/1 mempool/cnxk: fix halo enable devarg parsing
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.
--- drivers/mempool/cnxk/cnxk_mempool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mempool/cnxk/cnxk_mempool.c +2 -2
@@ -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 ; }
Signature · 1 line
2.48.1
one more reason to have common code for boolean flags. there is a bigish series to do that
Quoted 43 lines · On Thu, Oct 29, 2026, 22:17 Nawal Kishor <[email protected]> wrote:
parse_halo_ena_handler()kept the parsed value in auint8_tand stored it through auint8_tpointer, while the caller passes auint32_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 thatuint32_t, which is correct only on a little-endian host when the local is already zero.Parse and store a
uint32_tso 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 <[email protected]>--- drivers/mempool/cnxk/cnxk_mempool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mempool/cnxk/cnxk_mempool.c +2
-3@@ -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
Quoted 2 lines · Stephen Hemminger
one more reason to have common code for boolean flags. there is a bigish series to do that
Is your series merged? Stephen, Can I make this patch as Superseded?
Quoted 43 lines · On Thu, Oct 29, 2026, 22:17 Nawal Kishor <[email protected]> wrote:
Quoted 41 lines
parse_halo_ena_handler()kept the parsed value in auint8_tand stored it through auint8_tpointer, while the caller passes auint32_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 thatuint32_t, which is correct only on a little-endian host when the local is already zero.Parse and store a
uint32_tso 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 <[email protected]>--- drivers/mempool/cnxk/cnxk_mempool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/mempool/cnxk/cnxk_mempool.c +2
-3@@ -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
Quoted 6 lines · On Thu, 5 Nov 2026 22:25:26 +0530 Jerin Jacob <[email protected]> wrote:
Quoted 2 lines · Stephen Hemminger
one more reason to have common code for boolean flags. there is a bigish series to do that
Is your series merged? Stephen, Can I make this patch as Superseded?
Not merged, because series was so large and 26.11 was so big.
Quoted 7 lines · Stephen Hemminger
Quoted 3 lines · On Thu, 5 Nov 2026 22:25:26 +0530 Jerin Jacob <[email protected]> wrote:
Quoted 1 line · Stephen Hemminger
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
one more reason to have common code for boolean flags. there is a bigish series to do that
Is your series merged? Stephen, Can I make this patch as Superseded?
Not merged, because series was so large and 26.11 was so big.
Since it won't be merged for 26.11. I am taking this FIX for now.