mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jason Wang <jasowang@redhat.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH 1/2] macvtap: slient sparse warnings
Date: Wed, 12 Jun 2013 22:48:27 -0700	[thread overview]
Message-ID: <1371102507.3252.96.camel@edumazet-glaptop> (raw)
In-Reply-To: <1371097294-5626-1-git-send-email-jasowang@redhat.com>

On Thu, 2013-06-13 at 12:21 +0800, Jason Wang wrote:
> This patch silents the following sparse warnings:
> 
> dr
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/net/macvtap.c      |    2 +-
>  include/linux/if_macvlan.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
> index 992151c..acf55ba 100644
> --- a/drivers/net/macvtap.c
> +++ b/drivers/net/macvtap.c
> @@ -429,7 +429,7 @@ static int macvtap_open(struct inode *inode, struct file *file)
>  	if (!q)
>  		goto out;
>  
> -	q->sock.wq = &q->wq;
> +	rcu_assign_pointer(q->sock.wq, &q->wq);

Since nobody but you [1] can access this object at that time, you could
rather use
	RCU_INIT_POINTER(q->sock.wq, &q->wq);

rcu_assign_pointer() is also a documentation point (memory barrier)

By using RCU_INIT_POINTER() you clearly show that you know you need no
memory barrier.

>  	init_waitqueue_head(&q->wq.wait);

[1] :
or else, this init_waitqueue_head() should be done _before_ the
rcu_asign_pointer()

>  	q->sock.type = SOCK_RAW;
>  	q->sock.state = SS_CONNECTED;



  parent reply	other threads:[~2013-06-13  5:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-13  4:21 Jason Wang
2013-06-13  4:21 ` [net-next PATCH 2/2] macvtap: fix uninitialized return value macvtap_ioctl_set_queue() Jason Wang
2013-06-13  5:48 ` Eric Dumazet [this message]
2013-06-13  6:27   ` [net-next PATCH 1/2] macvtap: slient sparse warnings Jason Wang

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=1371102507.3252.96.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®