mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julian Anastasov <ja@ssi.bg>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, arm@kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Simon Horman <horms@verge.net.au>,
	netfilter-devel@vger.kernel.org, netfilter@vger.kernel.org,
	coreteam@netfilter.org
Subject: Re: [PATCH 08/16] ipvs: fix ip_vs_set_timeout debug messages
Date: Sat, 6 Oct 2012 11:09:41 +0300 (EEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1210061052170.1971@ja.ssi.bg> (raw)
In-Reply-To: <201210060645.05225.arnd@arndb.de>


	Hello,

On Sat, 6 Oct 2012, Arnd Bergmann wrote:

> On Friday 05 October 2012, Julian Anastasov wrote:
> > 
> > 	Hello,
> > 
> > On Fri, 5 Oct 2012, Arnd Bergmann wrote:
> > 
> > > The ip_vs_set_timeout function sets timeouts for TCP and UDP, which
> > > can be enabled independently at compile time. The debug message
> > > always prints both timeouts that are passed into the function,
> > > but if one is disabled, the message will show uninitialized data.
> > > 
> > > This splits the debug message into two separte IP_VS_DBG statements
> > > that are in the same #ifdef section to ensure we only print the
> > > text about what is actually going on.
> > > 
> > > Without this patch, building ARM ixp4xx_defconfig results in:
> > 
> > 	Are there any CONFIG_IP_VS_PROTO_xxx options in this
> > default config? It is a waste of memory if IPVS is compiled
> > without any protocols.
> 
> They all appear to be turned off:
> 
> $ grep CONFIG_IP_VS obj-tmp/.config
> CONFIG_IP_VS=m
> CONFIG_IP_VS_DEBUG=y
> CONFIG_IP_VS_TAB_BITS=12
> # CONFIG_IP_VS_PROTO_TCP is not set
> # CONFIG_IP_VS_PROTO_UDP is not set
> # CONFIG_IP_VS_PROTO_AH_ESP is not set
> # CONFIG_IP_VS_PROTO_ESP is not set
> # CONFIG_IP_VS_PROTO_AH is not set
> # CONFIG_IP_VS_PROTO_SCTP is not set
> CONFIG_IP_VS_RR=m
> CONFIG_IP_VS_WRR=m
> CONFIG_IP_VS_LC=m
> CONFIG_IP_VS_WLC=m
> CONFIG_IP_VS_LBLC=m
> CONFIG_IP_VS_LBLCR=m
> CONFIG_IP_VS_DH=m
> CONFIG_IP_VS_SH=m
> # CONFIG_IP_VS_SED is not set
> # CONFIG_IP_VS_NQ is not set
> CONFIG_IP_VS_SH_TAB_BITS=8

	Something should be changed here, may be at least
TCP/UDP, who knows.

> > > net/netfilter/ipvs/ip_vs_ctl.c: In function 'ip_vs_genl_set_cmd':
> > > net/netfilter/ipvs/ip_vs_ctl.c:2238:47: warning: 't.udp_timeout' may be used uninitialized in this function [-Wuninitialized]
> > > net/netfilter/ipvs/ip_vs_ctl.c:3322:28: note: 't.udp_timeout' was declared here
> > > net/netfilter/ipvs/ip_vs_ctl.c:2238:47: warning: 't.tcp_fin_timeout' may be used uninitialized in this function [-Wuninitialized]
> > > net/netfilter/ipvs/ip_vs_ctl.c:3322:28: note: 't.tcp_fin_timeout' was declared here
> > > net/netfilter/ipvs/ip_vs_ctl.c:2238:47: warning: 't.tcp_timeout' may be used uninitialized in this function [-Wuninitialized]
> > > net/netfilter/ipvs/ip_vs_ctl.c:3322:28: note: 't.tcp_timeout' was declared here
> > 
> > 	There are many __ip_vs_get_timeouts callers but
> > just one calls memset(&t, 0, sizeof(t)) before that,
> > problem only for ip_vs_genl_set_config and ip_vs_set_timeout.
> > 
> > 	To be safe, can we move this memset into
> > __ip_vs_get_timeouts instead of playing games with defines?:
> > 
> > 	memset(t, 0, sizeof(*t));
> > 
> > 	This debug message will be more precise in showing the
> > changed values if we replace the __ip_vs_get_timeouts 
> > call in ip_vs_genl_set_config with memset(&t, 0, sizeof(t)).
> > Then we will see 0 for values that are not changed/supported.
> 
> 8<-----
> ipvs: initialize returned data in do_ip_vs_get_ctl
> 
> As reported by a gcc warning, the do_ip_vs_get_ctl does not initalize
> all the members of the ip_vs_timeout_user structure it returns if
> at least one of the TCP or UDP protocols is disabled for ipvs. 
> 
> This makes sure that the data is always initialized, before it is
> returned as a response to IPVS_CMD_GET_CONFIG or printed as a
> debug message in IPVS_CMD_SET_CONFIG.
> 
> Without this patch, building ARM ixp4xx_defconfig results in:
> 
> net/netfilter/ipvs/ip_vs_ctl.c: In function 'ip_vs_genl_set_cmd':
> net/netfilter/ipvs/ip_vs_ctl.c:2238:47: warning: 't.udp_timeout' may be used uninitialized in this function [-Wuninitialized]
> net/netfilter/ipvs/ip_vs_ctl.c:3322:28: note: 't.udp_timeout' was declared here
> net/netfilter/ipvs/ip_vs_ctl.c:2238:47: warning: 't.tcp_fin_timeout' may be used uninitialized in this function [-Wuninitialized]
> net/netfilter/ipvs/ip_vs_ctl.c:3322:28: note: 't.tcp_fin_timeout' was declared here
> net/netfilter/ipvs/ip_vs_ctl.c:2238:47: warning: 't.tcp_timeout' may be used uninitialized in this function [-Wuninitialized]
> net/netfilter/ipvs/ip_vs_ctl.c:3322:28: note: 't.tcp_timeout' was declared here
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index 2770f85..3995d2e 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -2590,6 +2588,7 @@ __ip_vs_get_timeouts(struct net *net, struct ip_vs_timeout_user *u)
>  #if defined(CONFIG_IP_VS_PROTO_TCP) || defined(CONFIG_IP_VS_PROTO_UDP)
>  	struct ip_vs_proto_data *pd;
>  #endif

	That is what we want. If you plan another submission
you can add empty line before this memset and to replace
the __ip_vs_get_timeouts call in ip_vs_genl_set_config with
memset but they are cosmetic changes. Or may be Simon will
take care about the coding style when applying the change.

Acked-by: Julian Anastasov <ja@ssi.bg>

> +	memset(u, 0, sizeof (*u));
>  
>  #ifdef CONFIG_IP_VS_PROTO_TCP
>  	pd = ip_vs_proto_data_get(net, IPPROTO_TCP);
> @@ -2768,7 +2767,6 @@ do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
>  	{
>  		struct ip_vs_timeout_user t;
>  
> -		memset(&t, 0, sizeof(t));
>  		__ip_vs_get_timeouts(net, &t);
>  		if (copy_to_user(user, &t, sizeof(t)) != 0)
>  			ret = -EFAULT;

Regards

--
Julian Anastasov <ja@ssi.bg>

  reply	other threads:[~2012-10-06  8:05 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1349448930-23976-1-git-send-email-arnd@arndb.de>
2012-10-05 14:55 ` [PATCH 01/16] ARM: warnings in arch/arm/include/asm/uaccess.h Arnd Bergmann
2012-10-08  5:49   ` Greg Ungerer
2012-10-09 12:08     ` Arnd Bergmann
2012-10-05 14:55 ` [PATCH 02/16] ARM: binfmt_flat: unused variable 'persistent' Arnd Bergmann
2012-10-08  5:50   ` Greg Ungerer
2012-10-05 14:55 ` [PATCH 03/16] SCSI: ARM: ncr5380/oak uses no interrupts Arnd Bergmann
2012-10-05 14:55 ` [PATCH 04/16] SCSI: ARM: make fas216_dumpinfo function conditional Arnd Bergmann
2012-10-05 14:55 ` [PATCH 05/16] vfs: bogus warnings in fs/namei.c Arnd Bergmann
2012-10-08 11:51   ` Jan Kara
2012-10-09 12:27     ` Arnd Bergmann
2012-10-09 13:07       ` Arnd Bergmann
2012-10-09 13:43         ` Jan Kara
2012-10-11  4:37         ` Al Viro
2012-10-11 13:20           ` [PATCH v2] " Arnd Bergmann
2012-10-05 14:55 ` [PATCH 06/16] mm/slob: use min_t() to compare ARCH_SLAB_MINALIGN Arnd Bergmann
2012-10-05 16:46   ` Christoph Lameter
2012-10-31  7:25     ` Pekka Enberg
2012-10-05 14:55 ` [PATCH 07/16] cgroup: fix warning when building without any subsys Arnd Bergmann
2012-10-05 15:50   ` Ben Blum
2012-10-06  2:14   ` Tejun Heo
2012-10-06  6:19     ` Arnd Bergmann
2012-10-05 14:55 ` [PATCH 08/16] ipvs: fix ip_vs_set_timeout debug messages Arnd Bergmann
2012-10-05 20:39   ` Julian Anastasov
2012-10-06  6:45     ` Arnd Bergmann
2012-10-06  8:09       ` Julian Anastasov [this message]
2012-10-06  9:54         ` Arnd Bergmann
2012-10-09  1:48           ` Simon Horman
2012-10-05 14:55 ` [PATCH 09/16] USB: EHCI: mark ehci_orion_conf_mbus_windows __devinit Arnd Bergmann
2012-10-05 18:05   ` Alan Stern
2012-10-05 14:55 ` [PATCH 10/16] clk: don't mark clkdev_add_table as init Arnd Bergmann
2012-10-05 14:55 ` [PATCH 11/16] pcmcia: sharpsl: don't discard sharpsl_pcmcia_ops Arnd Bergmann
2012-10-05 14:55 ` [PATCH 12/16] video: mark nuc900fb_map_video_memory as __devinit Arnd Bergmann
2012-10-05 14:55 ` [PATCH 13/16] ARM: be really quiet when building with 'make -s' Arnd Bergmann
2012-10-05 16:36   ` Nicolas Pitre
2012-10-05 14:55 ` [PATCH 14/16] ARM: pxa: armcore: fix PCI PIO warnings Arnd Bergmann
2012-10-05 15:32   ` Igor Grinberg
2012-10-05 14:55 ` [PATCH 15/16] spi/s3c64xx: use correct dma_transfer_direction type Arnd Bergmann
2012-10-05 14:55 ` [PATCH 16/16] ARM: pass -marm to gcc by default for both C and assembler Arnd Bergmann
2012-10-05 18:42   ` Nicolas Pitre

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=alpine.LFD.2.00.1210061052170.1971@ja.ssi.bg \
    --to=ja@ssi.bg \
    --cc=arm@kernel.org \
    --cc=arnd@arndb.de \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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

all inboxes | Powered by JetHome®