public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: ebiederm@xmission•com (Eric W. Biederman)
To: Jing Wang <windsdaemon@gmail•com>
Cc: "David S. Miller" <davem@davemloft•net>,
	Eric Dumazet <edumazet@google•com>,
	Al Viro <viro@zeniv•linux.org.uk>,
	Pavel Emelyanov <xemul@parallels•com>,
	netdev@vger•kernel.org
Subject: Re: [PATCH 1/1] af_unix.c: fix the compile warning in unix_bind
Date: Sat, 27 Oct 2012 22:54:26 -0700	[thread overview]
Message-ID: <87390z87l9.fsf@xmission.com> (raw)
In-Reply-To: <1351219727-6085-1-git-send-email-windsdaemon@gmail.com> (Jing Wang's message of "Fri, 26 Oct 2012 10:48:47 +0800")

Jing Wang <windsdaemon@gmail•com> writes:

> Signed-off-by: Jing Wang <windsdaemon@gmail•com>
> ---
>  net/unix/af_unix.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 5b5c876..3f7d9d5 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -860,6 +860,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
>  	unsigned int hash;
>  	struct unix_address *addr;
>  	struct hlist_head *list;
> +	struct path path;
> +	umode_t mode;

This code motion to the top level in the function is also wrong.

>  	err = -EINVAL;
>  	if (sunaddr->sun_family != AF_UNIX)
> @@ -890,11 +892,12 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
>  	addr->len = addr_len;
>  	addr->hash = hash ^ sk->sk_type;
>  	atomic_set(&addr->refcnt, 1);
> -
> +
>  	if (sun_path[0]) {
> -		struct path path;
> -		umode_t mode = S_IFSOCK |
> +		mode = S_IFSOCK |
>  		       (SOCK_INODE(sock)->i_mode & ~current_umask());
> +
> +		memset(&path, 0, sizeof(path));
>  		err = unix_mknod(sun_path, mode, &path);
>  		if (err) {
>  			if (err == -EEXIST)

Eric

      parent reply	other threads:[~2012-10-28  5:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26  2:48 [PATCH 1/1] af_unix.c: fix the compile warning in unix_bind Jing Wang
2012-10-26  3:16 ` David Miller
2012-10-26  3:24   ` jing wang
2012-10-28  5:54 ` Eric W. Biederman [this message]

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=87390z87l9.fsf@xmission.com \
    --to=ebiederm@xmission$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=viro@zeniv$(echo .)linux.org.uk \
    --cc=windsdaemon@gmail$(echo .)com \
    --cc=xemul@parallels$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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