netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] af_unix: fix build warning
@ 2013-04-03  9:31 dingtianhong
  2013-04-03 12:27 ` Rami Rosen
  0 siblings, 1 reply; 3+ messages in thread
From: dingtianhong @ 2013-04-03  9:31 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, netdev, Li Zefan

net/unix/af_unix.c: In function ‘unix_bind’:
net/unix/af_unix.c:892: warning: ‘path.mnt’ may be used uninitialized in this function
net/unix/af_unix.c:892: warning: ‘path.dentry’ may be used uninitialized in this function

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 971282b..3ccc049 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -889,7 +889,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
 	atomic_set(&addr->refcnt, 1);

 	if (sun_path[0]) {
-		struct path path;
+		struct path path = {};
 		umode_t mode = S_IFSOCK |
 		       (SOCK_INODE(sock)->i_mode & ~current_umask());
 		err = unix_mknod(sun_path, mode, &path);
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] af_unix: fix build warning
  2013-04-03  9:31 [PATCH] af_unix: fix build warning dingtianhong
@ 2013-04-03 12:27 ` Rami Rosen
  2013-04-04  7:00   ` dingtianhong
  0 siblings, 1 reply; 3+ messages in thread
From: Rami Rosen @ 2013-04-03 12:27 UTC (permalink / raw)
  To: dingtianhong; +Cc: David S. Miller, Eric Dumazet, Netdev, Li Zefan

Hi,
Which version of gcc are you using ?
A patch like yours, for the same method, unix_bind(), was sent in the
past, and Stephen Hemminger noted the
with gcc 4.7 the warning you got does not occur.
see:
http://permalink.gmane.org/gmane.linux.network/247807

Best Regards,

Rami Rosen
http://ramirose.wix.com/ramirosen


On Wed, Apr 3, 2013 at 12:31 PM, dingtianhong <dingtianhong@huawei.com> wrote:
> net/unix/af_unix.c: In function ‘unix_bind’:
> net/unix/af_unix.c:892: warning: ‘path.mnt’ may be used uninitialized in this function
> net/unix/af_unix.c:892: warning: ‘path.dentry’ may be used uninitialized in this function
>
> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
> ---
>  net/unix/af_unix.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 971282b..3ccc049 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -889,7 +889,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
>         atomic_set(&addr->refcnt, 1);
>
>         if (sun_path[0]) {
> -               struct path path;
> +               struct path path = {};
>                 umode_t mode = S_IFSOCK |
>                        (SOCK_INODE(sock)->i_mode & ~current_umask());
>                 err = unix_mknod(sun_path, mode, &path);
> --
> 1.8.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] af_unix: fix build warning
  2013-04-03 12:27 ` Rami Rosen
@ 2013-04-04  7:00   ` dingtianhong
  0 siblings, 0 replies; 3+ messages in thread
From: dingtianhong @ 2013-04-04  7:00 UTC (permalink / raw)
  To: Rami Rosen; +Cc: David S. Miller, Eric Dumazet, Netdev, Li Zefan

On 2013/4/3 20:27, Rami Rosen wrote:
> Hi,
> Which version of gcc are you using ?
> A patch like yours, for the same method, unix_bind(), was sent in the
> past, and Stephen Hemminger noted the
> with gcc 4.7 the warning you got does not occur.
> see:
> http://permalink.gmane.org/gmane.linux.network/247807
> 
> Best Regards,
> 
> Rami Rosen
> http://ramirose.wix.com/ramirosen
> 

ok,thanks

> 
> On Wed, Apr 3, 2013 at 12:31 PM, dingtianhong <dingtianhong@huawei.com> wrote:
>> net/unix/af_unix.c: In function ‘unix_bind’:
>> net/unix/af_unix.c:892: warning: ‘path.mnt’ may be used uninitialized in this function
>> net/unix/af_unix.c:892: warning: ‘path.dentry’ may be used uninitialized in this function
>>
>> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
>> ---
>>  net/unix/af_unix.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
>> index 971282b..3ccc049 100644
>> --- a/net/unix/af_unix.c
>> +++ b/net/unix/af_unix.c
>> @@ -889,7 +889,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
>>         atomic_set(&addr->refcnt, 1);
>>
>>         if (sun_path[0]) {
>> -               struct path path;
>> +               struct path path = {};
>>                 umode_t mode = S_IFSOCK |
>>                        (SOCK_INODE(sock)->i_mode & ~current_umask());
>>                 err = unix_mknod(sun_path, mode, &path);
>> --
>> 1.8.0
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe netdev" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-04  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-03  9:31 [PATCH] af_unix: fix build warning dingtianhong
2013-04-03 12:27 ` Rami Rosen
2013-04-04  7:00   ` dingtianhong

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