[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZH23SwFoyHuQ4AIx@corigine.com>
Date: Mon, 5 Jun 2023 12:22:03 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: netdev@...r.kernel.org, kernel@...atatu.com, deb.chatterjee@...el.com,
anjali.singhai@...el.com, namrata.limaye@...el.com,
khalidm@...dia.com, tom@...anda.io, pratyush@...anda.io,
jiri@...nulli.us, xiyou.wangcong@...il.com, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
vladbu@...dia.com
Subject: Re: [PATCH net-next RFC 13/20] p4tc: add metadata create, update,
delete, get, flush and dump
On Tue, Jan 24, 2023 at 12:05:03PM -0500, Jamal Hadi Salim wrote:
...
Hi Victor, Jamal and Pedro,
some minor feedback from my side.
> +struct p4tc_metadata *tcf_meta_create(struct nlmsghdr *n, struct nlattr *nla,
> + u32 m_id, struct p4tc_pipeline *pipeline,
> + struct netlink_ext_ack *extack)
A gcc-12 build with W=1 suggests that this function could be static.
...
> +static int _tcf_meta_fill_nlmsg(struct sk_buff *skb,
> + const struct p4tc_metadata *meta)
> +{
> + unsigned char *b = nlmsg_get_pos(skb);
> + struct p4tc_meta_size_params sz_params;
> + struct nlattr *nest;
> +
> + if (nla_put_u32(skb, P4TC_PATH, meta->m_id))
> + goto out_nlmsg_trim;
> +
> + nest = nla_nest_start(skb, P4TC_PARAMS);
> + if (!nest)
> + goto out_nlmsg_trim;
> +
> + sz_params.datatype = meta->m_datatype;
> + sz_params.startbit = meta->m_startbit;
> + sz_params.endbit = meta->m_endbit;
There may be a hole at the end of sz_params, which is uninitialised,
yet fed into nl_put below.
> +
> + if (nla_put_string(skb, P4TC_META_NAME, meta->common.name))
> + goto out_nlmsg_trim;
> + if (nla_put(skb, P4TC_META_SIZE, sizeof(sz_params), &sz_params))
> + goto out_nlmsg_trim;
> +
> + nla_nest_end(skb, nest);
> +
> + return skb->len;
> +
> +out_nlmsg_trim:
> + nlmsg_trim(skb, b);
> + return -1;
> +}
...
Powered by blists - more mailing lists