From: Jiri Pirko <jiri@resnulli.us>
To: "Keller, Jacob E" <jacob.e.keller@intel.com>
Cc: "Kitszel, Przemyslaw" <przemyslaw.kitszel@intel.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"Hadi Salim, Jamal" <jhs@mojatatu.com>,
"johannes@sipsolutions.net" <johannes@sipsolutions.net>,
"andriy.shevchenko@linux.intel.com"
<andriy.shevchenko@linux.intel.com>,
"Nambiar, Amritha" <amritha.nambiar@intel.com>,
"sdf@google.com" <sdf@google.com>,
"horms@kernel.org" <horms@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [patch net-next v4 8/9] devlink: add a command to set notification filter and use it for multicasts
Date: Tue, 5 Dec 2023 08:47:43 +0100 [thread overview]
Message-ID: <ZW7Vn4F6bm2hYgpi@nanopsycho> (raw)
In-Reply-To: <CO1PR11MB5089142F465D060B9AE3FDC0D686A@CO1PR11MB5089.namprd11.prod.outlook.com>
Mon, Dec 04, 2023 at 08:17:24PM CET, jacob.e.keller@intel.com wrote:
>
>
>> -----Original Message-----
>> From: Jiri Pirko <jiri@resnulli.us>
>> Sent: Monday, December 4, 2023 8:25 AM
>> To: Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
>> Cc: kuba@kernel.org; pabeni@redhat.com; davem@davemloft.net;
>> edumazet@google.com; Keller, Jacob E <jacob.e.keller@intel.com>; Hadi Salim,
>> Jamal <jhs@mojatatu.com>; johannes@sipsolutions.net;
>> andriy.shevchenko@linux.intel.com; Nambiar, Amritha
>> <amritha.nambiar@intel.com>; sdf@google.com; horms@kernel.org;
>> netdev@vger.kernel.org
>> Subject: Re: [patch net-next v4 8/9] devlink: add a command to set notification
>> filter and use it for multicasts
>>
>> Mon, Nov 27, 2023 at 04:40:22PM CET, przemyslaw.kitszel@intel.com wrote:
>> >On 11/23/23 19:15, Jiri Pirko wrote:
>> >> From: Jiri Pirko <jiri@nvidia.com>
>> >>
>>
>> [...]
>>
>>
>> >> diff --git a/net/devlink/netlink.c b/net/devlink/netlink.c
>> >> index fa9afe3e6d9b..33a8e51dea68 100644
>> >> --- a/net/devlink/netlink.c
>> >> +++ b/net/devlink/netlink.c
>> >> @@ -17,6 +17,79 @@ static const struct genl_multicast_group
>> devlink_nl_mcgrps[] = {
>> >> [DEVLINK_MCGRP_CONFIG] = { .name =
>> DEVLINK_GENL_MCGRP_CONFIG_NAME },
>> >> };
>> >> +int devlink_nl_notify_filter_set_doit(struct sk_buff *skb,
>> >> + struct genl_info *info)
>> >> +{
>> >> + struct nlattr **attrs = info->attrs;
>> >> + struct devlink_obj_desc *flt;
>> >> + size_t data_offset = 0;
>> >> + size_t data_size = 0;
>> >> + char *pos;
>> >> +
>> >> + if (attrs[DEVLINK_ATTR_BUS_NAME])
>> >> + data_size += nla_len(attrs[DEVLINK_ATTR_BUS_NAME]) + 1;
>> >> + if (attrs[DEVLINK_ATTR_DEV_NAME])
>> >> + data_size += nla_len(attrs[DEVLINK_ATTR_DEV_NAME]) + 1;
>> >> +
>> >> + flt = kzalloc(sizeof(*flt) + data_size, GFP_KERNEL);
>> >
>> >instead of arithmetic here, you could use struct_size()
>>
>> That is used for flex array, yet I have no flex array here.
>>
>
>Yea this isn't a flexible array. You could use size_add to ensure that this can't overflow. I don't know what the bound on the attribute sizes is.
Okay, will do that to be on a safe side.
>
next prev parent reply other threads:[~2023-12-05 7:47 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 18:15 [patch net-next v4 0/9] devlink: introduce notifications filtering Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 1/9] devlink: use devl_is_registered() helper instead xa_get_mark() Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 2/9] devlink: introduce __devl_is_registered() helper and use it instead of xa_get_mark() Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 3/9] devlink: send notifications only if there are listeners Jiri Pirko
2023-11-27 11:01 ` Paolo Abeni
2023-11-27 12:04 ` Jiri Pirko
2023-11-27 15:00 ` Paolo Abeni
2023-11-28 7:39 ` Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 4/9] devlink: introduce a helper for netlink multicast send Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 5/9] genetlink: introduce per-sock family private pointer storage Jiri Pirko
2023-11-27 11:13 ` Paolo Abeni
2023-11-27 12:00 ` Jiri Pirko
2023-11-27 22:46 ` Jakub Kicinski
2023-11-28 8:25 ` Jiri Pirko
2023-11-28 15:11 ` Jakub Kicinski
2023-11-28 16:05 ` Jiri Pirko
2023-11-28 16:36 ` Jakub Kicinski
2023-11-29 13:59 ` Jiri Pirko
2023-11-29 15:01 ` Jakub Kicinski
2023-11-29 15:25 ` Jiri Pirko
2023-11-28 12:30 ` Przemek Kitszel
2023-11-28 15:05 ` Jiri Pirko
2023-11-28 16:18 ` Andy Shevchenko
2023-11-28 19:59 ` Jacob Keller
2023-11-28 20:06 ` Andy Shevchenko
2023-11-29 23:29 ` Jacob Keller
2023-11-23 18:15 ` [patch net-next v4 6/9] netlink: introduce typedef for filter function Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 7/9] genetlink: introduce helpers to do filtered multicast Jiri Pirko
2023-11-23 18:15 ` [patch net-next v4 8/9] devlink: add a command to set notification filter and use it for multicasts Jiri Pirko
2023-11-27 12:30 ` Przemek Kitszel
2023-11-27 12:51 ` Jiri Pirko
2023-11-27 12:56 ` Jiri Pirko
2023-11-27 15:40 ` Przemek Kitszel
2023-11-28 8:26 ` Jiri Pirko
2023-12-04 16:24 ` Jiri Pirko
2023-12-04 16:47 ` Andy Shevchenko
2023-12-04 19:17 ` Keller, Jacob E
2023-12-05 7:47 ` Jiri Pirko [this message]
2023-12-05 15:58 ` andriy.shevchenko
2023-11-23 18:15 ` [patch net-next v4 9/9] devlink: extend multicast filtering by port index Jiri Pirko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZW7Vn4F6bm2hYgpi@nanopsycho \
--to=jiri@resnulli.us \
--cc=amritha.nambiar@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jhs@mojatatu.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox