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 ?

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to