* [PATCH 1/1] af_unix.c: fix the compile warning in unix_bind
@ 2012-10-26 2:48 Jing Wang
2012-10-26 3:16 ` David Miller
2012-10-28 5:54 ` Eric W. Biederman
0 siblings, 2 replies; 4+ messages in thread
From: Jing Wang @ 2012-10-26 2:48 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Al Viro, Pavel Emelyanov; +Cc: netdev, Jing Wang
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;
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)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] af_unix.c: fix the compile warning in unix_bind
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
1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2012-10-26 3:16 UTC (permalink / raw)
To: windsdaemon; +Cc: edumazet, viro, xemul, netdev
From: Jing Wang <windsdaemon@gmail.com>
Date: Fri, 26 Oct 2012 10:48:47 +0800
>
> Signed-off-by: Jing Wang <windsdaemon@gmail.com>
What compile warning? You need to describe what problem
you are solving, rather than assume we can figure it out
by reading your patch.
> -
> +
This doesn't do anything and should be in your patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] af_unix.c: fix the compile warning in unix_bind
2012-10-26 3:16 ` David Miller
@ 2012-10-26 3:24 ` jing wang
0 siblings, 0 replies; 4+ messages in thread
From: jing wang @ 2012-10-26 3:24 UTC (permalink / raw)
To: David Miller; +Cc: edumazet, viro, xemul, netdev
Thanks for your review and i'm sorry about this, the warning is :
CC net/unix/af_unix.o
net/unix/af_unix.c: In function 'unix_bind':
net/unix/af_unix.c:895: warning: 'path.dentry' may be used uninitialized
in this function
net/unix/af_unix.c:895: warning: 'path.mnt' may be used uninitialized in
this function
于 2012年10月26日 11:16, David Miller 写道:
> From: Jing Wang <windsdaemon@gmail.com>
> Date: Fri, 26 Oct 2012 10:48:47 +0800
>
>> Signed-off-by: Jing Wang <windsdaemon@gmail.com>
> What compile warning? You need to describe what problem
> you are solving, rather than assume we can figure it out
> by reading your patch.
>
>> -
>> +
> This doesn't do anything and should be in your patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] af_unix.c: fix the compile warning in unix_bind
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-28 5:54 ` Eric W. Biederman
1 sibling, 0 replies; 4+ messages in thread
From: Eric W. Biederman @ 2012-10-28 5:54 UTC (permalink / raw)
To: Jing Wang; +Cc: David S. Miller, Eric Dumazet, Al Viro, Pavel Emelyanov, netdev
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-10-28 5:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).