All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
To: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
Cc: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Paul E. McKenney"
	<paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Subject: Re: [PATCH] IB/core: Suppress a sparse warning
Date: Mon, 10 Mar 2014 16:02:13 +0100	[thread overview]
Message-ID: <1394463733.3257.62.camel@localhost.localdomain> (raw)
In-Reply-To: <531DCB7D.9020104-HInyCGIudOg@public.gmane.org>

Hi,

Le lundi 10 mars 2014 à 15:26 +0100, Bart Van Assche a écrit :
> 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 ?
> 

Thanks for investigating.

I'm not an expert in RCU, but I believe it then miss the RCU annotations
around the RCU reader section (ensure correct ordering if I recall
correctly).

Cc: "Paul E. McKenney" <paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>

> 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) {

+		rcu_read_lock();

> -		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);

+		rcu_read_unlock();


Regards.

-- 
Yann Droneaud
OPTEYA


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-03-10 15:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-10 12:22 [PATCH] IB/core: Suppress a sparse warning Bart Van Assche
     [not found] ` <531DAEA1.7060703-HInyCGIudOg@public.gmane.org>
2014-03-10 13:33   ` Yann Droneaud
     [not found]     ` <1394458406.3257.53.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-03-10 14:26       ` Bart Van Assche
     [not found]         ` <531DCB7D.9020104-HInyCGIudOg@public.gmane.org>
2014-03-10 15:02           ` Yann Droneaud [this message]
     [not found]             ` <1394463733.3257.62.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2014-03-10 16:08               ` Paul E. McKenney
     [not found]                 ` <20140310160803.GC21124-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2014-03-12 10:15                   ` Bart Van Assche
     [not found]                     ` <532033C5.7030803-HInyCGIudOg@public.gmane.org>
2014-03-12 17:54                       ` Moni Shoua

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=1394463733.3257.62.camel@localhost.localdomain \
    --to=ydroneaud-rly5vtjfyj3qt0dzr+alfa@public.gmane.org \
    --cc=bvanassche-HInyCGIudOg@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=monis-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.