Skip to contentSkip to conversation

bonding - uninitialize static variables

PATCH Superseded Carlo Perassi 2 participants 2 messages Jun 23, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bonding - uninitialize static variables

Hi.

One of the tasks at http://janitor.kernelnewbies.org/TODO
is described as
"
uninitialize static variables initialized to 0, to make it go to the .bss, instead of .data.
"

To proof that it is still guaranteed that those variables will be initialized to zero

Tom Bradley <[email protected]> (on the kernel-janitors mailing list) wrote
"
the default for gcc is `-fzero-initialized-in-bss', the kernel makefile does not change this therefore bss is zeroed, this is documented in the gcc manpage.
"

and David P Howell <[email protected]> added that "
By definition .bss is always zero'ed by the implementation. "

This patch uninitializes five static int initialized to 0.

---
 drivers/net/bonding/bond_main.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/bonding/bond_main.c +5 -5
Index: linux-2.6.12/drivers/net/bonding/bond_main.c
===================================================================
@@ -531,8 +531,8 @@
 
 static int max_bonds	= BOND_DEFAULT_MAX_BONDS;
 static int miimon	= BOND_LINK_MON_INTERV;
-static int updelay	= 0;
-static int downdelay	= 0;
+static int updelay;
+static int downdelay;
 static int use_carrier	= 1;
 static char *mode	= NULL;
 static char *primary	= NULL;
@@ -573,11 +573,11 @@
 #endif
 
 static u32 arp_target[BOND_MAX_ARP_TARGETS] = { 0, } ;
-static int arp_ip_count	= 0;
+static int arp_ip_count;
 static u32 my_ip	= 0;
 static int bond_mode	= BOND_MODE_ROUNDROBIN;
-static int lacp_fast	= 0;
-static int app_abi_ver	= 0;
+static int lacp_fast;
+static int app_abi_ver;
 static int orig_app_abi_ver = -1; /* This is used to save the first ABI version
 				   * we receive from the application. Once set,
 				   * it won't be changed, and the module will

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

On Thu, 23 Jun 2005 21:29:02 +0200 Carlo Perassi wrote:

| This patch uninitializes five static int initialized to 0.
| 
| Signed-off-by: Carlo Perassi <[email protected]>
| ---
|  drivers/net/bonding/bond_main.c |   10 +++++-----
|  1 files changed, 5 insertions(+), 5 deletions(-)
| 
| Index: linux-2.6.12/drivers/net/bonding/bond_main.c
| ===================================================================
| --- linux-2.6.12.orig/drivers/net/bonding/bond_main.c
| +++ linux-2.6.12/drivers/net/bonding/bond_main.c
| @@ -531,8 +531,8 @@
|  
|  static int max_bonds	= BOND_DEFAULT_MAX_BONDS;
|  static int miimon	= BOND_LINK_MON_INTERV;
| -static int updelay	= 0;
| -static int downdelay	= 0;
| +static int updelay;
| +static int downdelay;
|  static int use_carrier	= 1;
|  static char *mode	= NULL;
|  static char *primary	= NULL;

Those NULLs can also be discarded.

---
~Randy

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors