On 03/10/14 14:33, Yann Droneaud wrote:
> Le lundi 10 mars 2014 à 13:22 +0100, Bart Van Assche a écrit :
>> Suppress the following sparse warning:
>> include/rdma/ib_addr.h:187:24: warning: cast removes address space of 
>> expression
> 
> You should explain why there's a warning here, and why is it safe to
> cast. (I believe it's related to RCU domain ?)

Hello Yann,

Now that I've had a closer look at the code in include/rdma/ib_addr.h,
that code probably isn't safe. How about the (untested) patch below ?

diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index ce55906..5a416ac 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -184,7 +184,7 @@ static inline void iboe_addr_get_sgid(struct rdma_dev_addr 
*dev_addr,
 
        dev = dev_get_by_index(&init_net, dev_addr->bound_dev_if);
        if (dev) {
-               ip4 = (struct in_device *)dev->ip_ptr;
+               ip4 = __in_dev_get_rcu(dev);
                if (ip4 && ip4->ifa_list && ip4->ifa_list->ifa_address)
                        ipv6_addr_set_v4mapped(ip4->ifa_list->ifa_address,
                                               (struct in6_addr *)gid);
-- 
1.8.4.5


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to