[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5804E8DE.20200@uclouvain.be>
Date: Mon, 17 Oct 2016 17:06:06 +0200
From: David Lebrun <david.lebrun@...ouvain.be>
To: David Miller <davem@...emloft.net>
CC: <netdev@...r.kernel.org>
Subject: Re: [PATCH 2/9] ipv6: sr: add code base for control plane support
of SR-IPv6
On 10/17/2016 05:00 PM, David Miller wrote:
> 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.
>
Will do
>> + 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.
>
The mutex is not taken, just initialized. Unless mutex_init takes the
lock, which would be quite strange ?
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists