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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 18 Sep 2017 08:00:34 -0700
From:   Eric Dumazet <eric.dumazet@...il.com>
To:     David Laight <David.Laight@...LAB.COM>
Cc:     'Colin King' <colin.king@...onical.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        "David S . Miller" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net_sched: use explicit size of struct tcmsg, remove
 need to declare tcm

On Mon, 2017-09-18 at 12:18 +0000, David Laight wrote:
> From: Colin King
> > Sent: 18 September 2017 12:41
> > Pointer tcm is being initialized and is never read, it is only being used
> > to determine the size of struct tcmsg.  Clean this up by removing
> > variable tcm and explicitly using the sizeof struct tcmsg rather than *tcm.
> > Cleans up clang warning:
> > 
> > warning: Value stored to 'tcm' during its initialization is never read
> > 
> > Signed-off-by: Colin Ian King <colin.king@...onical.com>
> > ---
> >  net/sched/sch_api.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> > index c6deb74e3d2f..aa82116ed10c 100644
> > --- a/net/sched/sch_api.c
> > +++ b/net/sched/sch_api.c
> > @@ -1500,7 +1500,6 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
> >  	int s_idx, s_q_idx;
> >  	struct net_device *dev;
> >  	const struct nlmsghdr *nlh = cb->nlh;
> > -	struct tcmsg *tcm = nlmsg_data(nlh);
> >  	struct nlattr *tca[TCA_MAX + 1];
> >  	int err;
> > 
> > @@ -1510,7 +1509,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
> >  	idx = 0;
> >  	ASSERT_RTNL();
> > 
> > -	err = nlmsg_parse(nlh, sizeof(*tcm), tca, TCA_MAX, NULL, NULL);
> > +	err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, NULL, NULL);
> 
> Would sizeof(*nlmsg_data(nlh)) be cleaner??

Not really, since 

static inline void *nlmsg_data(const struct nlmsghdr *nlh)
{
...
}




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ