[PATCH v3 60/65] net/hns3: use kvargs hex helper for capability mask
fengchengwen
fengchengwen at huawei.com
Sat Oct 10 04:43:33 CEST 2026
Acked-by: Chengwen Feng <fengchengwen at huawei.com>
On 10/1/2026 6:41 AM, Stephen Hemminger wrote:
> hns3_parse_dev_caps_mask() does no validation whatsoever: strtoull() is
> called with neither errno cleared nor the end pointer checked, so
> "dev_caps_mask=junk" is silently taken as zero and "dev_caps_mask=-1"
> wraps around to enable every capability.
>
> The value is documented as a hexadecimal mask, so use
> rte_kvargs_handle_hex64(), which reads it as hexadecimal with or without
> a 0x prefix. The documented form "dev_caps_mask=0xF" is unchanged, and
> so is a bare "F".
>
> Note that hns3_parse_devargs() discards the rte_kvargs_process() return
> value for every argument it parses, so a malformed mask is now reported
> but still leaves the default of zero in place rather than failing probe.
> Propagating those errors is a behaviour change per argument and is left
> for a separate patch.
>
> HNS3_CONVERT_TO_HEXADECIMAL loses its last user here, and
> HNS3_CONVERT_TO_DECIMAL lost its own earlier in this series, so remove
> both.
>
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
More information about the dev
mailing list