lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAFAkD-prZmSd_FWxiphUnpC7i-s88E4QVniANT5ZpG4HC1a2A@mail.gmail.com>
Date: Mon, 5 Jun 2023 10:45:57 -0400
From: Jamal Hadi Salim <hadi@...atatu.com>
To: Simon Horman <simon.horman@...igine.com>
Cc: Jamal Hadi Salim <jhs@...atatu.com>, 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 Mon, Jun 5, 2023 at 6:22 AM Simon Horman <simon.horman@...igine.com> wrote:
>
> 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.
>

Ok, makes sense.
Looking at our CICD we run gcc-11. Would it be beneficial to switch to 12?

> ...
>
> > +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.
>

Two ways to resolve that:
We could do:
struct p4tc_meta_size_params sz_params = {}
or add explicit PADx fields at the end of that struct.
Thoughts?

cheers,
jamal

> > +
> > +     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

Powered by Openwall GNU/*/Linux Powered by OpenVZ