* [PATCH 1/1] net: fix compile warning in af_unix.c
@ 2012-10-30 7:16 Jing Wang
2012-10-30 14:00 ` Stephen Hemminger
0 siblings, 1 reply; 3+ messages in thread
From: Jing Wang @ 2012-10-30 7:16 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Al Viro, Pavel Emelyanov; +Cc: netdev, Jing Wang
This patch fix some compile warning as follows:
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
Signed-off-by: Jing Wang <windsdaemon@gmail.com>
---
net/unix/af_unix.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 5b5c876..9f710ac 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -895,6 +895,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
struct path path;
umode_t mode = S_IFSOCK |
(SOCK_INODE(sock)->i_mode & ~current_umask());
+ path.mnt = NULL;
+ path.dentry = NULL;
err = unix_mknod(sun_path, mode, &path);
if (err) {
if (err == -EEXIST)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net: fix compile warning in af_unix.c
2012-10-30 7:16 [PATCH 1/1] net: fix compile warning in af_unix.c Jing Wang
@ 2012-10-30 14:00 ` Stephen Hemminger
2012-10-31 0:46 ` jing wang
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2012-10-30 14:00 UTC (permalink / raw)
To: Jing Wang; +Cc: David S. Miller, Eric Dumazet, Al Viro, Pavel Emelyanov, netdev
On Tue, 30 Oct 2012 15:16:36 +0800
Jing Wang <windsdaemon@gmail.com> wrote:
> This patch fix some compile warning as follows:
> 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
>
> Signed-off-by: Jing Wang <windsdaemon@gmail.com>
> ---
> net/unix/af_unix.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 5b5c876..9f710ac 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -895,6 +895,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
> struct path path;
> umode_t mode = S_IFSOCK |
> (SOCK_INODE(sock)->i_mode & ~current_umask());
> + path.mnt = NULL;
> + path.dentry = NULL;
> err = unix_mknod(sun_path, mode, &path);
> if (err) {
> if (err == -EEXIST)
I appreciate the effort to silence warnings. But this warning is a false
positive that only occurs on some versions of Gcc. With gcc 4.7 the
warning does not occur.
The general consensus has been NOT to do initializations or other changes
if the problem is due to Gcc bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net: fix compile warning in af_unix.c
2012-10-30 14:00 ` Stephen Hemminger
@ 2012-10-31 0:46 ` jing wang
0 siblings, 0 replies; 3+ messages in thread
From: jing wang @ 2012-10-31 0:46 UTC (permalink / raw)
To: Stephen Hemminger
Cc: David S. Miller, Eric Dumazet, Al Viro, Pavel Emelyanov, netdev
于 2012年10月30日 22:00, Stephen Hemminger 写道:
> On Tue, 30 Oct 2012 15:16:36 +0800
> Jing Wang <windsdaemon@gmail.com> wrote:
>
>> This patch fix some compile warning as follows:
>> 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
>>
>> Signed-off-by: Jing Wang <windsdaemon@gmail.com>
>> ---
>> net/unix/af_unix.c | 2 ++
>> 1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
>> index 5b5c876..9f710ac 100644
>> --- a/net/unix/af_unix.c
>> +++ b/net/unix/af_unix.c
>> @@ -895,6 +895,8 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
>> struct path path;
>> umode_t mode = S_IFSOCK |
>> (SOCK_INODE(sock)->i_mode & ~current_umask());
>> + path.mnt = NULL;
>> + path.dentry = NULL;
>> err = unix_mknod(sun_path, mode, &path);
>> if (err) {
>> if (err == -EEXIST)
> I appreciate the effort to silence warnings. But this warning is a false
> positive that only occurs on some versions of Gcc. With gcc 4.7 the
> warning does not occur.
>
> The general consensus has been NOT to do initializations or other changes
> if the problem is due to Gcc bug.
>
Thanks for you review, you're right, the version of my gcc is 4.4.6 !
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-10-31 0:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-30 7:16 [PATCH 1/1] net: fix compile warning in af_unix.c Jing Wang
2012-10-30 14:00 ` Stephen Hemminger
2012-10-31 0:46 ` jing wang
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).