linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] vxlan: silence one build warning
@ 2013-10-25  7:49 Zhi Yong Wu
  2013-10-25  7:49 ` [PATCH 2/3] net, datagram: fix the uncorrect comment in zerocopy_sg_from_iovec() Zhi Yong Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Zhi Yong Wu @ 2013-10-25  7:49 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
  LD      drivers/net/built-in.o

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 drivers/net/vxlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 2ef5b62..e15f1af 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2272,7 +2272,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
 {
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	struct vxlan_sock *vs;
-	struct socket *sock;
+	struct socket *sock = NULL;
 	struct sock *sk;
 	int rc = 0;
 	unsigned int h;
-- 
1.7.11.7


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

* [PATCH 2/3] net, datagram: fix the uncorrect comment in zerocopy_sg_from_iovec()
  2013-10-25  7:49 [PATCH 1/3] vxlan: silence one build warning Zhi Yong Wu
@ 2013-10-25  7:49 ` Zhi Yong Wu
  2013-10-28  4:39   ` David Miller
  2013-10-25  7:49 ` [PATCH 3/3] net, iovec: fix the uncorrect comment in memcpy_fromiovecend() Zhi Yong Wu
  2013-10-25 15:41 ` [PATCH 1/3] vxlan: silence one build warning Stephen Hemminger
  2 siblings, 1 reply; 11+ messages in thread
From: Zhi Yong Wu @ 2013-10-25  7:49 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 net/core/datagram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/datagram.c b/net/core/datagram.c
index af814e7..a16ed7b 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -577,7 +577,7 @@ EXPORT_SYMBOL(skb_copy_datagram_from_iovec);
 /**
  *	zerocopy_sg_from_iovec - Build a zerocopy datagram from an iovec
  *	@skb: buffer to copy
- *	@from: io vector to copy to
+ *	@from: io vector to copy from
  *	@offset: offset in the io vector to start copying from
  *	@count: amount of vectors to copy to buffer from
  *
-- 
1.7.11.7


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

* [PATCH 3/3] net, iovec: fix the uncorrect comment in memcpy_fromiovecend()
  2013-10-25  7:49 [PATCH 1/3] vxlan: silence one build warning Zhi Yong Wu
  2013-10-25  7:49 ` [PATCH 2/3] net, datagram: fix the uncorrect comment in zerocopy_sg_from_iovec() Zhi Yong Wu
@ 2013-10-25  7:49 ` Zhi Yong Wu
  2013-10-25 15:41 ` [PATCH 1/3] vxlan: silence one build warning Stephen Hemminger
  2 siblings, 0 replies; 11+ messages in thread
From: Zhi Yong Wu @ 2013-10-25  7:49 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 net/core/iovec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/iovec.c b/net/core/iovec.c
index b77eeec..4cdb7c4 100644
--- a/net/core/iovec.c
+++ b/net/core/iovec.c
@@ -100,7 +100,7 @@ int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata,
 EXPORT_SYMBOL(memcpy_toiovecend);
 
 /*
- *	Copy iovec from kernel. Returns -EFAULT on error.
+ *	Copy iovec to kernel. Returns -EFAULT on error.
  */
 
 int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov,
-- 
1.7.11.7


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

* Re: [PATCH 1/3] vxlan: silence one build warning
  2013-10-25  7:49 [PATCH 1/3] vxlan: silence one build warning Zhi Yong Wu
  2013-10-25  7:49 ` [PATCH 2/3] net, datagram: fix the uncorrect comment in zerocopy_sg_from_iovec() Zhi Yong Wu
  2013-10-25  7:49 ` [PATCH 3/3] net, iovec: fix the uncorrect comment in memcpy_fromiovecend() Zhi Yong Wu
@ 2013-10-25 15:41 ` Stephen Hemminger
  2013-10-26  7:06   ` Zhi Yong Wu
  2013-10-28  4:38   ` David Miller
  2 siblings, 2 replies; 11+ messages in thread
From: Stephen Hemminger @ 2013-10-25 15:41 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: netdev, linux-kernel, Zhi Yong Wu

On Fri, 25 Oct 2013 15:49:18 +0800
Zhi Yong Wu <zwu.kernel@gmail.com> wrote:

> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
> drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
>   LD      drivers/net/built-in.o
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> ---
>  drivers/net/vxlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index 2ef5b62..e15f1af 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2272,7 +2272,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
>  {
>  	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>  	struct vxlan_sock *vs;
> -	struct socket *sock;
> +	struct socket *sock = NULL;
>  	struct sock *sk;
>  	int rc = 0;
>  	unsigned int h;

This only happens with certain versions of Gcc which have buggy dependency
analysis. It doesn't happen with Gcc 4.7, think it only shows up in 4.4.
I would rather not fix the warning this way since it risks masking later bugs if this code ever changes.

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

* Re: [PATCH 1/3] vxlan: silence one build warning
  2013-10-25 15:41 ` [PATCH 1/3] vxlan: silence one build warning Stephen Hemminger
@ 2013-10-26  7:06   ` Zhi Yong Wu
  2013-10-26 14:48     ` Stephen Hemminger
  2013-10-28  4:38   ` David Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Zhi Yong Wu @ 2013-10-26  7:06 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, linux-kernel mlist, Zhi Yong Wu

On Fri, Oct 25, 2013 at 11:41 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Fri, 25 Oct 2013 15:49:18 +0800
> Zhi Yong Wu <zwu.kernel@gmail.com> wrote:
>
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
>> drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>> drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
>>   LD      drivers/net/built-in.o
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> ---
>>  drivers/net/vxlan.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
>> index 2ef5b62..e15f1af 100644
>> --- a/drivers/net/vxlan.c
>> +++ b/drivers/net/vxlan.c
>> @@ -2272,7 +2272,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
>>  {
>>       struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>>       struct vxlan_sock *vs;
>> -     struct socket *sock;
>> +     struct socket *sock = NULL;
>>       struct sock *sk;
>>       int rc = 0;
>>       unsigned int h;
>
> This only happens with certain versions of Gcc which have buggy dependency
> analysis. It doesn't happen with Gcc 4.7, think it only shows up in 4.4.
> I would rather not fix the warning this way since it risks masking later bugs if this code ever changes.
Gcc version is 4.7.2 on my box, this warning took palce.
# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
...
gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)


-- 
Regards,

Zhi Yong Wu

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

* Re: [PATCH 1/3] vxlan: silence one build warning
  2013-10-26  7:06   ` Zhi Yong Wu
@ 2013-10-26 14:48     ` Stephen Hemminger
  2013-10-27  2:30       ` Zhi Yong Wu
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2013-10-26 14:48 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: netdev, linux-kernel mlist, Zhi Yong Wu

On Sat, 26 Oct 2013 15:06:04 +0800
Zhi Yong Wu <zwu.kernel@gmail.com> wrote:

> On Fri, Oct 25, 2013 at 11:41 PM, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > On Fri, 25 Oct 2013 15:49:18 +0800
> > Zhi Yong Wu <zwu.kernel@gmail.com> wrote:
> >
> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >>
> >> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
> >> drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> >> drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
> >>   LD      drivers/net/built-in.o
> >>
> >> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >> ---
> >>  drivers/net/vxlan.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> >> index 2ef5b62..e15f1af 100644
> >> --- a/drivers/net/vxlan.c
> >> +++ b/drivers/net/vxlan.c
> >> @@ -2272,7 +2272,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
> >>  {
> >>       struct vxlan_net *vn = net_generic(net, vxlan_net_id);
> >>       struct vxlan_sock *vs;
> >> -     struct socket *sock;
> >> +     struct socket *sock = NULL;
> >>       struct sock *sk;
> >>       int rc = 0;
> >>       unsigned int h;
> >
> > This only happens with certain versions of Gcc which have buggy dependency
> > analysis. It doesn't happen with Gcc 4.7, think it only shows up in 4.4.
> > I would rather not fix the warning this way since it risks masking later bugs if this code ever changes.
> Gcc version is 4.7.2 on my box, this warning took palce.
> # gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> ...
> gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
> 
> 

I dont see it on Debian 7.
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc-4.7.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)

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

* Re: [PATCH 1/3] vxlan: silence one build warning
  2013-10-26 14:48     ` Stephen Hemminger
@ 2013-10-27  2:30       ` Zhi Yong Wu
  2013-10-27 19:33         ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: Zhi Yong Wu @ 2013-10-27  2:30 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, linux-kernel mlist, Zhi Yong Wu

HI, Stephen

I saw it on Fedora 17 without latest kernel. Then what do you think
that it is appropriate to solve this problem? discard this patch? If
yes, i can also agree.


On Sat, Oct 26, 2013 at 10:48 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Sat, 26 Oct 2013 15:06:04 +0800
> Zhi Yong Wu <zwu.kernel@gmail.com> wrote:
>
>> On Fri, Oct 25, 2013 at 11:41 PM, Stephen Hemminger
>> <stephen@networkplumber.org> wrote:
>> > On Fri, 25 Oct 2013 15:49:18 +0800
>> > Zhi Yong Wu <zwu.kernel@gmail.com> wrote:
>> >
>> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >>
>> >> drivers/net/vxlan.c: In function ‘vxlan_sock_add’:
>> >> drivers/net/vxlan.c:2298:11: warning: ‘sock’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>> >> drivers/net/vxlan.c:2275:17: note: ‘sock’ was declared here
>> >>   LD      drivers/net/built-in.o
>> >>
>> >> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >> ---
>> >>  drivers/net/vxlan.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
>> >> index 2ef5b62..e15f1af 100644
>> >> --- a/drivers/net/vxlan.c
>> >> +++ b/drivers/net/vxlan.c
>> >> @@ -2272,7 +2272,7 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port,
>> >>  {
>> >>       struct vxlan_net *vn = net_generic(net, vxlan_net_id);
>> >>       struct vxlan_sock *vs;
>> >> -     struct socket *sock;
>> >> +     struct socket *sock = NULL;
>> >>       struct sock *sk;
>> >>       int rc = 0;
>> >>       unsigned int h;
>> >
>> > This only happens with certain versions of Gcc which have buggy dependency
>> > analysis. It doesn't happen with Gcc 4.7, think it only shows up in 4.4.
>> > I would rather not fix the warning this way since it risks masking later bugs if this code ever changes.
>> Gcc version is 4.7.2 on my box, this warning took palce.
>> # gcc -v
>> Using built-in specs.
>> COLLECT_GCC=gcc
>> ...
>> gcc version 4.7.2 20120921 (Red Hat 4.7.2-2) (GCC)
>>
>>
>
> I dont see it on Debian 7.
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/gcc-4.7.real
> COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
> Target: x86_64-linux-gnu
> Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
> Thread model: posix
> gcc version 4.7.2 (Debian 4.7.2-5)



-- 
Regards,

Zhi Yong Wu

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

* Re: [PATCH 1/3] vxlan: silence one build warning
  2013-10-27  2:30       ` Zhi Yong Wu
@ 2013-10-27 19:33         ` Stephen Hemminger
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2013-10-27 19:33 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: netdev, linux-kernel mlist, Zhi Yong Wu

On Sun, 27 Oct 2013 10:30:56 +0800
Zhi Yong Wu <zwu.kernel@gmail.com> wrote:

> HI, Stephen
> 
> I saw it on Fedora 17 without latest kernel. Then what do you think
> that it is appropriate to solve this problem? discard this patch? If
> yes, i can also agree.
> 

Either find where the uninitialized use is being caused by finding the code
path where it happens (manual analysis), or ignore the warning.



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

* Re: [PATCH 1/3] vxlan: silence one build warning
  2013-10-25 15:41 ` [PATCH 1/3] vxlan: silence one build warning Stephen Hemminger
  2013-10-26  7:06   ` Zhi Yong Wu
@ 2013-10-28  4:38   ` David Miller
  2013-10-28 15:25     ` Stephen Hemminger
  1 sibling, 1 reply; 11+ messages in thread
From: David Miller @ 2013-10-28  4:38 UTC (permalink / raw)
  To: stephen; +Cc: zwu.kernel, netdev, linux-kernel, wuzhy

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Fri, 25 Oct 2013 08:41:34 -0700

> I would rather not fix the warning this way since it risks masking
> later bugs if this code ever changes.

But this is suboptimally coded, and is asking for the warning.

Anything returning a pointer by reference is asking for trouble
in my opinion.

The correct thing to do is to make create_v{4,6}_sock() return
the "struct socket *" as an error pointer.

No more ambiguous initializations, no more warnings.

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

* Re: [PATCH 2/3] net, datagram: fix the uncorrect comment in zerocopy_sg_from_iovec()
  2013-10-25  7:49 ` [PATCH 2/3] net, datagram: fix the uncorrect comment in zerocopy_sg_from_iovec() Zhi Yong Wu
@ 2013-10-28  4:39   ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2013-10-28  4:39 UTC (permalink / raw)
  To: zwu.kernel; +Cc: netdev, linux-kernel, wuzhy


"uncorrect" is not a word, you mean to say "incorrect".

Same goes for patch #3.

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

* Re: [PATCH 1/3] vxlan: silence one build warning
  2013-10-28  4:38   ` David Miller
@ 2013-10-28 15:25     ` Stephen Hemminger
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Hemminger @ 2013-10-28 15:25 UTC (permalink / raw)
  To: David Miller; +Cc: zwu.kernel, netdev, linux-kernel, wuzhy

On Mon, 28 Oct 2013 00:38:07 -0400 (EDT)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <stephen@networkplumber.org>
> Date: Fri, 25 Oct 2013 08:41:34 -0700
> 
> > I would rather not fix the warning this way since it risks masking
> > later bugs if this code ever changes.
> 
> But this is suboptimally coded, and is asking for the warning.
> 
> Anything returning a pointer by reference is asking for trouble
> in my opinion.
> 
> The correct thing to do is to make create_v{4,6}_sock() return
> the "struct socket *" as an error pointer.
> 
> No more ambiguous initializations, no more warnings.

Agreed, original code used ERR_PTR (see vxlan_socket_create),
the side effect stuff only came with the addition of IPv6.

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

end of thread, other threads:[~2013-10-28 15:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25  7:49 [PATCH 1/3] vxlan: silence one build warning Zhi Yong Wu
2013-10-25  7:49 ` [PATCH 2/3] net, datagram: fix the uncorrect comment in zerocopy_sg_from_iovec() Zhi Yong Wu
2013-10-28  4:39   ` David Miller
2013-10-25  7:49 ` [PATCH 3/3] net, iovec: fix the uncorrect comment in memcpy_fromiovecend() Zhi Yong Wu
2013-10-25 15:41 ` [PATCH 1/3] vxlan: silence one build warning Stephen Hemminger
2013-10-26  7:06   ` Zhi Yong Wu
2013-10-26 14:48     ` Stephen Hemminger
2013-10-27  2:30       ` Zhi Yong Wu
2013-10-27 19:33         ` Stephen Hemminger
2013-10-28  4:38   ` David Miller
2013-10-28 15:25     ` Stephen Hemminger

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