[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8b9ad2bc-138a-408e-8608-e9b784192649@nvidia.com>
Date: Wed, 28 Feb 2024 21:24:21 -0800
From: William Tu <witu@...dia.com>
To: Jiri Pirko <jiri@...nulli.us>, Simon Horman <horms@...nel.org>
Cc: netdev@...r.kernel.org, jiri@...dia.com, bodong@...dia.com,
tariqt@...dia.com, yossiku@...dia.com, kuba@...nel.org
Subject: Re: [PATCH net-next RFC 1/2] devlink: Add shared descriptor eswitch
attr
On 2/28/24 5:20 AM, Jiri Pirko wrote:
> External email: Use caution opening links or attachments
>
>
> Wed, Feb 28, 2024 at 02:12:49PM CET, horms@...nel.org wrote:
>> On Wed, Feb 28, 2024 at 03:59:53AM +0200, William Tu wrote:
>>
>> ...
>>
>>> diff --git a/net/devlink/netlink_gen.c b/net/devlink/netlink_gen.c
>>> index c81cf2dd154f..ac8b0c7105dd 100644
>>> --- a/net/devlink/netlink_gen.c
>>> +++ b/net/devlink/netlink_gen.c
>>> @@ -194,12 +194,14 @@ static const struct nla_policy devlink_eswitch_get_nl_policy[DEVLINK_ATTR_DEV_NA
>>> };
>>>
>>> /* DEVLINK_CMD_ESWITCH_SET - do */
>>> -static const struct nla_policy devlink_eswitch_set_nl_policy[DEVLINK_ATTR_ESWITCH_ENCAP_MODE + 1] = {
>>> +static const struct nla_policy devlink_eswitch_set_nl_policy[DEVLINK_ATTR_ESWITCH_SHRDESC_COUNT + 1] = {
>>> [DEVLINK_ATTR_BUS_NAME] = { .type = NLA_NUL_STRING, },
>>> [DEVLINK_ATTR_DEV_NAME] = { .type = NLA_NUL_STRING, },
>>> [DEVLINK_ATTR_ESWITCH_MODE] = NLA_POLICY_MAX(NLA_U16, 1),
>>> [DEVLINK_ATTR_ESWITCH_INLINE_MODE] = NLA_POLICY_MAX(NLA_U16, 3),
>>> [DEVLINK_ATTR_ESWITCH_ENCAP_MODE] = NLA_POLICY_MAX(NLA_U8, 1),
>>> + [DEVLINK_ATTR_ESWITCH_SHRDESC_MODE] = NLA_POLICY_MAX(NLA_U8, 1),
>>> + [DEVLINK_ATTR_ESWITCH_SHRDESC_COUNT] = NLA_POLICY_MAX(NLA_U32, 65535),
>>> };
>> Hi William,
>>
>> I realise this is probably not central to your purpose in sending an RFC,
>> but my understanding is that the max value set using NLA_POLICY_MAX
>> is of type s16, and thus 65535 is too large - it becomes -1.
>>
>> Flagged by W=1 build with clang-17.
> First of all:
> /* Do not edit directly, auto-generated from: */
> /* Documentation/netlink/specs/devlink.yaml */
>
>
>
Hi Jiri and Simon,
Thanks for the feedback. Will fix it.
William
Powered by blists - more mailing lists