netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: david.lebrun@uclouvain.be
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/9] ipv6: sr: add code base for control plane support of SR-IPv6
Date: Mon, 17 Oct 2016 11:00:55 -0400 (EDT)	[thread overview]
Message-ID: <20161017.110055.762862023679772858.davem@davemloft.net> (raw)
In-Reply-To: <1476715350-18983-3-git-send-email-david.lebrun@uclouvain.be>

From: David Lebrun <david.lebrun@uclouvain.be>
Date: Mon, 17 Oct 2016 16:42:23 +0200

> +static int seg6_genl_set_tunsrc(struct sk_buff *skb, struct genl_info *info)
> +{
> +	struct net *net = genl_info_net(info);
> +	struct seg6_pernet_data *sdata = seg6_pernet(net);
> +	struct in6_addr *val, *t_old, *t_new;

Please ordre local variables from longest to shortest line (AKA reverse
christmas tree layout).

Please audit your entire submission for this problem.

> +	val = (struct in6_addr *)nla_data(info->attrs[SEG6_ATTR_DST]);

Please remove all casts from void pointers, they are completely unecessary.
Since nla_data() returns "(void *)", this applies here.

Please audit your entire submission for this problem.

> +	mutex_init(&sdata->lock);
> +
> +	sdata->tun_src = kzalloc(sizeof(*sdata->tun_src), GFP_KERNEL);
> +	if (!sdata->tun_src) {
> +		kfree(sdata);
> +		return -ENOMEM;

Best not to free an object while you still hold a mutex inside of it.

Also taking the mutex makes no sense at all, this object has no global
visibility, therefore no other thread of control can operate upon it.

  reply	other threads:[~2016-10-17 15:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 14:42 [PATCH 0/9] net: add support for IPv6 Segment Routing David Lebrun
2016-10-17 14:42 ` [PATCH 1/9] ipv6: implement dataplane support for rthdr type 4 (Segment Routing Header) David Lebrun
2016-10-17 14:57   ` David Miller
2016-10-17 15:04     ` David Lebrun
2016-10-17 17:01   ` Tom Herbert
2016-10-18 11:43     ` David Lebrun
2016-10-20 13:04     ` David Lebrun
2016-10-20 15:47       ` Tom Herbert
2016-10-17 17:31   ` Tom Herbert
2016-10-17 14:42 ` [PATCH 2/9] ipv6: sr: add code base for control plane support of SR-IPv6 David Lebrun
2016-10-17 15:00   ` David Miller [this message]
2016-10-17 15:06     ` David Lebrun
2016-10-17 15:21       ` David Miller
2016-10-17 17:07   ` Tom Herbert
2016-10-18 11:45     ` David Lebrun
2016-10-17 14:42 ` [PATCH 3/9] ipv6: sr: add support for SRH encapsulation and injection with lwtunnels David Lebrun
2016-10-17 17:17   ` Tom Herbert
2016-10-18 11:47     ` David Lebrun
2016-10-17 14:42 ` [PATCH 4/9] ipv6: sr: add core files for SR HMAC support David Lebrun
2016-10-17 17:24   ` Tom Herbert
2016-10-18 12:07     ` David Lebrun
2016-10-19 13:20   ` zhuyj
2016-10-19 14:43     ` David Laight
2016-10-17 14:43 ` [PATCH 5/9] ipv6: sr: implement API to control SR HMAC structures David Lebrun
2016-10-17 14:43 ` [PATCH 6/9] ipv6: sr: add calls to verify and insert HMAC signatures David Lebrun
2016-10-17 14:43 ` [PATCH 7/9] ipv6: add source address argument for ipv6_push_nfrag_opts David Lebrun
2016-10-17 14:43 ` [PATCH 8/9] ipv6: sr: add support for SRH injection through setsockopt David Lebrun
2016-10-17 14:43 ` [PATCH 9/9] ipv6: sr: add documentation file for per-interface sysctls David Lebrun
2016-10-17 15:09 ` [PATCH 0/9] net: add support for IPv6 Segment Routing David Laight

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=20161017.110055.762862023679772858.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=david.lebrun@uclouvain.be \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).