[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zd8zECmvTWF_gZO5@nanopsycho>
Date: Wed, 28 Feb 2024 14:20:16 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Simon Horman <horms@...nel.org>
Cc: William Tu <witu@...dia.com>, 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
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 */
>
>>
>> /* DEVLINK_CMD_DPIPE_TABLE_GET - do */
>
>...
>
Powered by blists - more mailing lists