[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221019144534.04d22ced@kernel.org>
Date: Wed, 19 Oct 2022 14:45:34 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: <davem@...emloft.net>, <johannes@...solutions.net>,
<netdev@...r.kernel.org>, <edumazet@...gle.com>,
<pabeni@...hat.com>, <jiri@...nulli.us>, <razor@...ckwall.org>,
<nicolas.dichtel@...nd.com>, <gnault@...hat.com>, <fw@...len.de>
Subject: Re: [PATCH net-next 05/13] genetlink: check for callback type at op
load time
On Wed, 19 Oct 2022 14:33:39 -0700 Jacob Keller wrote:
> > +static int
> > genl_cmd_full_to_split(struct genl_split_ops *op,
> > const struct genl_family *family,
> > const struct genl_ops *full, u8 flags)
> > {
> > + if ((flags & GENL_CMD_CAP_DO && !full->doit) ||
> > + (flags & GENL_CMD_CAP_DUMP && !full->dumpit)) {
> > + memset(op, 0, sizeof(*op));
> > + return -ENOENT;
> > + }
> > +
>
> Should this check that exactly one of GENL_CMD_CAP_DO and
> GENL_CMD_CAP_DUMP is set? Or is some earlier flow enforcing this?
I check at registration time that the family-provided flags only
have one of those two set. Internally, inside genetlink.c it'd be
a programming error to request both at the same time, IOW it'd be
defensive programming to check for it.
Powered by blists - more mailing lists