public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] remove null-ifiers
@ 2004-01-14 13:15 Jes Sorensen
       [not found] ` <E1AgkrW-00080w-00-uLT3q8aHQDsX9StFTm9pZA@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Jes Sorensen @ 2004-01-14 13:15 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: len.brown-ral2JQCrhuEAvxtiuMwx3w

Hi,

The included patch removes a number of NULL-ilizers from the ACPI code
resulting in variables being put in the data segment instead of the bss
segment.

Patch is relative to Andrew's 2.6.1-mm3 patch.

Cheers,
Jes

diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/ac.c linux-2.6.1-mm3/drivers/acpi/ac.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/ac.c	Wed Dec 17 18:58:47 2003
+++ linux-2.6.1-mm3/drivers/acpi/ac.c	Wed Jan 14 04:55:10 2004
@@ -108,7 +108,7 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-struct proc_dir_entry		*acpi_ac_dir = NULL;
+struct proc_dir_entry		*acpi_ac_dir;
 
 int acpi_ac_seq_show(struct seq_file *seq, void *offset)
 {
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c linux-2.6.1-mm3/drivers/acpi/asus_acpi.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c	Wed Dec 17 18:58:39 2003
+++ linux-2.6.1-mm3/drivers/acpi/asus_acpi.c	Wed Jan 14 05:00:01 2004
@@ -73,8 +73,8 @@
 MODULE_LICENSE("GPL");
 
 
-static uid_t asus_uid = 0;
-static gid_t asus_gid = 0;
+static uid_t asus_uid;
+static gid_t asus_gid;
 MODULE_PARM(asus_uid, "i");
 MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
 MODULE_PARM(asus_gid, "i");
@@ -192,14 +192,14 @@
 };
 
 /* procdir we use */
-static struct proc_dir_entry *asus_proc_dir = NULL;
+static struct proc_dir_entry *asus_proc_dir;
 
 /*
  * This header is made available to allow proper configuration given model,
  * revision number , ... this info cannot go in struct asus_hotk because it is
  * available before the hotk
  */
-static struct acpi_table_header *asus_info = NULL;
+static struct acpi_table_header *asus_info;
 
 /*
  * The hotkey driver declaration
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/battery.c linux-2.6.1-mm3/drivers/acpi/battery.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/battery.c	Wed Dec 17 18:59:17 2003
+++ linux-2.6.1-mm3/drivers/acpi/battery.c	Wed Jan 14 04:56:10 2004
@@ -340,7 +340,7 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-struct proc_dir_entry		*acpi_battery_dir = NULL;
+struct proc_dir_entry		*acpi_battery_dir;
 
 static int
 acpi_battery_read_info (
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/button.c linux-2.6.1-mm3/drivers/acpi/button.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/button.c	Wed Dec 17 18:58:06 2003
+++ linux-2.6.1-mm3/drivers/acpi/button.c	Wed Jan 14 04:56:39 2004
@@ -107,7 +107,7 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-static struct proc_dir_entry	*acpi_button_dir = NULL;
+static struct proc_dir_entry	*acpi_button_dir;
 
 static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
 {
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/ec.c linux-2.6.1-mm3/drivers/acpi/ec.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/ec.c	Wed Dec 17 18:58:56 2003
+++ linux-2.6.1-mm3/drivers/acpi/ec.c	Wed Jan 14 04:57:01 2004
@@ -475,7 +475,7 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-struct proc_dir_entry		*acpi_ec_dir = NULL;
+struct proc_dir_entry		*acpi_ec_dir;
 
 
 static int
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/fan.c linux-2.6.1-mm3/drivers/acpi/fan.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/fan.c	Wed Dec 17 18:58:07 2003
+++ linux-2.6.1-mm3/drivers/acpi/fan.c	Wed Jan 14 04:57:17 2004
@@ -71,7 +71,7 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-struct proc_dir_entry		*acpi_fan_dir = NULL;
+struct proc_dir_entry		*acpi_fan_dir;
 
 
 static int
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/osl.c linux-2.6.1-mm3/drivers/acpi/osl.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/osl.c	Wed Jan 14 02:59:49 2004
+++ linux-2.6.1-mm3/drivers/acpi/osl.c	Wed Jan 14 05:00:25 2004
@@ -59,13 +59,13 @@
 #ifdef ENABLE_DEBUGGER
 #include <linux/kdb.h>
 /* stuff for debugger support */
-int acpi_in_debugger = 0;
+int acpi_in_debugger;
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER*/
 
-static int acpi_irq_irq = 0;
-static OSD_HANDLER acpi_irq_handler = NULL;
-static void *acpi_irq_context = NULL;
+static int acpi_irq_irq;
+static OSD_HANDLER acpi_irq_handler;
+static void *acpi_irq_context;
 
 acpi_status
 acpi_os_initialize(void)
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/power.c linux-2.6.1-mm3/drivers/acpi/power.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/power.c	Wed Dec 17 18:58:56 2003
+++ linux-2.6.1-mm3/drivers/acpi/power.c	Wed Jan 14 04:58:13 2004
@@ -387,7 +387,7 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-struct proc_dir_entry		*acpi_power_dir = NULL;
+struct proc_dir_entry		*acpi_power_dir;
 
 static int acpi_power_seq_show(struct seq_file *seq, void *offset)
 {
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/processor.c linux-2.6.1-mm3/drivers/acpi/processor.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/processor.c	Wed Dec 17 18:59:05 2003
+++ linux-2.6.1-mm3/drivers/acpi/processor.c	Wed Jan 14 04:58:27 2004
@@ -138,7 +138,7 @@
 
 static struct acpi_processor	*processors[NR_CPUS];
 static struct acpi_processor_errata errata;
-static void (*pm_idle_save)(void) = NULL;
+static void (*pm_idle_save)(void);
 
 
 /* --------------------------------------------------------------------------
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/thermal.c linux-2.6.1-mm3/drivers/acpi/thermal.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/thermal.c	Wed Jan 14 02:59:49 2004
+++ linux-2.6.1-mm3/drivers/acpi/thermal.c	Wed Jan 14 04:59:18 2004
@@ -74,7 +74,7 @@
 MODULE_DESCRIPTION(ACPI_THERMAL_DRIVER_NAME);
 MODULE_LICENSE("GPL");
 
-static int tzp = 0;
+static int tzp;
 MODULE_PARM(tzp, "i");
 MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
 
@@ -766,7 +766,7 @@
                               FS Interface (/proc)
    -------------------------------------------------------------------------- */
 
-struct proc_dir_entry		*acpi_thermal_dir = NULL;
+struct proc_dir_entry		*acpi_thermal_dir;
 
 static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
 {
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/toshiba_acpi.c linux-2.6.1-mm3/drivers/acpi/toshiba_acpi.c
--- orig/linux-2.6.1-mm3-boot/drivers/acpi/toshiba_acpi.c	Wed Dec 17 18:58:07 2003
+++ linux-2.6.1-mm3/drivers/acpi/toshiba_acpi.c	Wed Jan 14 04:59:33 2004
@@ -215,7 +215,7 @@
 	return status;
 }
 
-static struct proc_dir_entry*	toshiba_proc_dir = NULL;
+static struct proc_dir_entry*	toshiba_proc_dir;
 static int			force_fan;
 static int			last_key_event;
 static int			key_event_valid;


-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html

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

* Re: [patch] remove null-ifiers
       [not found] ` <E1AgkrW-00080w-00-uLT3q8aHQDsX9StFTm9pZA@public.gmane.org>
@ 2004-01-26 20:58   ` Len Brown
  2004-01-27 15:09   ` Karol Kozimor
  1 sibling, 0 replies; 13+ messages in thread
From: Len Brown @ 2004-01-26 20:58 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: ACPI Developers

Accepted.

thanks,
-Len


On Wed, 2004-01-14 at 08:15, Jes Sorensen wrote:
> Hi,
> 
> The included patch removes a number of NULL-ilizers from the ACPI code
> resulting in variables being put in the data segment instead of the bss
> segment.
> 
> Patch is relative to Andrew's 2.6.1-mm3 patch.
> 
> Cheers,
> Jes
> 
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/ac.c linux-2.6.1-mm3/drivers/acpi/ac.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/ac.c	Wed Dec 17 18:58:47 2003
> +++ linux-2.6.1-mm3/drivers/acpi/ac.c	Wed Jan 14 04:55:10 2004
> @@ -108,7 +108,7 @@
>                                FS Interface (/proc)
>     -------------------------------------------------------------------------- */
>  
> -struct proc_dir_entry		*acpi_ac_dir = NULL;
> +struct proc_dir_entry		*acpi_ac_dir;
>  
>  int acpi_ac_seq_show(struct seq_file *seq, void *offset)
>  {
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c linux-2.6.1-mm3/drivers/acpi/asus_acpi.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c	Wed Dec 17 18:58:39 2003
> +++ linux-2.6.1-mm3/drivers/acpi/asus_acpi.c	Wed Jan 14 05:00:01 2004
> @@ -73,8 +73,8 @@
>  MODULE_LICENSE("GPL");
>  
> 
> -static uid_t asus_uid = 0;
> -static gid_t asus_gid = 0;
> +static uid_t asus_uid;
> +static gid_t asus_gid;
>  MODULE_PARM(asus_uid, "i");
>  MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
>  MODULE_PARM(asus_gid, "i");
> @@ -192,14 +192,14 @@
>  };
>  
>  /* procdir we use */
> -static struct proc_dir_entry *asus_proc_dir = NULL;
> +static struct proc_dir_entry *asus_proc_dir;
>  
>  /*
>   * This header is made available to allow proper configuration given model,
>   * revision number , ... this info cannot go in struct asus_hotk because it is
>   * available before the hotk
>   */
> -static struct acpi_table_header *asus_info = NULL;
> +static struct acpi_table_header *asus_info;
>  
>  /*
>   * The hotkey driver declaration
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/battery.c linux-2.6.1-mm3/drivers/acpi/battery.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/battery.c	Wed Dec 17 18:59:17 2003
> +++ linux-2.6.1-mm3/drivers/acpi/battery.c	Wed Jan 14 04:56:10 2004
> @@ -340,7 +340,7 @@
>                                FS Interface (/proc)
>     -------------------------------------------------------------------------- */
>  
> -struct proc_dir_entry		*acpi_battery_dir = NULL;
> +struct proc_dir_entry		*acpi_battery_dir;
>  
>  static int
>  acpi_battery_read_info (
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/button.c linux-2.6.1-mm3/drivers/acpi/button.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/button.c	Wed Dec 17 18:58:06 2003
> +++ linux-2.6.1-mm3/drivers/acpi/button.c	Wed Jan 14 04:56:39 2004
> @@ -107,7 +107,7 @@
>                                FS Interface (/proc)
>     -------------------------------------------------------------------------- */
>  
> -static struct proc_dir_entry	*acpi_button_dir = NULL;
> +static struct proc_dir_entry	*acpi_button_dir;
>  
>  static int acpi_button_info_seq_show(struct seq_file *seq, void *offset)
>  {
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/ec.c linux-2.6.1-mm3/drivers/acpi/ec.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/ec.c	Wed Dec 17 18:58:56 2003
> +++ linux-2.6.1-mm3/drivers/acpi/ec.c	Wed Jan 14 04:57:01 2004
> @@ -475,7 +475,7 @@
>                                FS Interface (/proc)
>     -------------------------------------------------------------------------- */
>  
> -struct proc_dir_entry		*acpi_ec_dir = NULL;
> +struct proc_dir_entry		*acpi_ec_dir;
>  
> 
>  static int
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/fan.c linux-2.6.1-mm3/drivers/acpi/fan.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/fan.c	Wed Dec 17 18:58:07 2003
> +++ linux-2.6.1-mm3/drivers/acpi/fan.c	Wed Jan 14 04:57:17 2004
> @@ -71,7 +71,7 @@
>                                FS Interface (/proc)
>     -------------------------------------------------------------------------- */
>  
> -struct proc_dir_entry		*acpi_fan_dir = NULL;
> +struct proc_dir_entry		*acpi_fan_dir;
>  
> 
>  static int
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/osl.c linux-2.6.1-mm3/drivers/acpi/osl.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/osl.c	Wed Jan 14 02:59:49 2004
> +++ linux-2.6.1-mm3/drivers/acpi/osl.c	Wed Jan 14 05:00:25 2004
> @@ -59,13 +59,13 @@
>  #ifdef ENABLE_DEBUGGER
>  #include <linux/kdb.h>
>  /* stuff for debugger support */
> -int acpi_in_debugger = 0;
> +int acpi_in_debugger;
>  extern char line_buf[80];
>  #endif /*ENABLE_DEBUGGER*/
>  
> -static int acpi_irq_irq = 0;
> -static OSD_HANDLER acpi_irq_handler = NULL;
> -static void *acpi_irq_context = NULL;
> +static int acpi_irq_irq;
> +static OSD_HANDLER acpi_irq_handler;
> +static void *acpi_irq_context;
>  
>  acpi_status
>  acpi_os_initialize(void)
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/power.c linux-2.6.1-mm3/drivers/acpi/power.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/power.c	Wed Dec 17 18:58:56 2003
> +++ linux-2.6.1-mm3/drivers/acpi/power.c	Wed Jan 14 04:58:13 2004
> @@ -387,7 +387,7 @@
>                                FS Interface (/proc)
>     -------------------------------------------------------------------------- */
>  
> -struct proc_dir_entry		*acpi_power_dir = NULL;
> +struct proc_dir_entry		*acpi_power_dir;
>  
>  static int acpi_power_seq_show(struct seq_file *seq, void *offset)
>  {
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/processor.c linux-2.6.1-mm3/drivers/acpi/processor.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/processor.c	Wed Dec 17 18:59:05 2003
> +++ linux-2.6.1-mm3/drivers/acpi/processor.c	Wed Jan 14 04:58:27 2004
> @@ -138,7 +138,7 @@
>  
>  static struct acpi_processor	*processors[NR_CPUS];
>  static struct acpi_processor_errata errata;
> -static void (*pm_idle_save)(void) = NULL;
> +static void (*pm_idle_save)(void);
>  
> 
>  /* --------------------------------------------------------------------------
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/thermal.c linux-2.6.1-mm3/drivers/acpi/thermal.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/thermal.c	Wed Jan 14 02:59:49 2004
> +++ linux-2.6.1-mm3/drivers/acpi/thermal.c	Wed Jan 14 04:59:18 2004
> @@ -74,7 +74,7 @@
>  MODULE_DESCRIPTION(ACPI_THERMAL_DRIVER_NAME);
>  MODULE_LICENSE("GPL");
>  
> -static int tzp = 0;
> +static int tzp;
>  MODULE_PARM(tzp, "i");
>  MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
>  
> @@ -766,7 +766,7 @@
>                                FS Interface (/proc)
>     -------------------------------------------------------------------------- */
>  
> -struct proc_dir_entry		*acpi_thermal_dir = NULL;
> +struct proc_dir_entry		*acpi_thermal_dir;
>  
>  static int acpi_thermal_state_seq_show(struct seq_file *seq, void *offset)
>  {
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/toshiba_acpi.c linux-2.6.1-mm3/drivers/acpi/toshiba_acpi.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/toshiba_acpi.c	Wed Dec 17 18:58:07 2003
> +++ linux-2.6.1-mm3/drivers/acpi/toshiba_acpi.c	Wed Jan 14 04:59:33 2004
> @@ -215,7 +215,7 @@
>  	return status;
>  }
>  
> -static struct proc_dir_entry*	toshiba_proc_dir = NULL;
> +static struct proc_dir_entry*	toshiba_proc_dir;
>  static int			force_fan;
>  static int			last_key_event;
>  static int			key_event_valid;



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found] ` <E1AgkrW-00080w-00-uLT3q8aHQDsX9StFTm9pZA@public.gmane.org>
  2004-01-26 20:58   ` Len Brown
@ 2004-01-27 15:09   ` Karol Kozimor
       [not found]     ` <20040127150954.GA12740-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Karol Kozimor @ 2004-01-27 15:09 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

Thus wrote Jes Sorensen:
> diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c linux-2.6.1-mm3/drivers/acpi/asus_acpi.c
> --- orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c	Wed Dec 17 18:58:39 2003
> +++ linux-2.6.1-mm3/drivers/acpi/asus_acpi.c	Wed Jan 14 05:00:01 2004
> @@ -73,8 +73,8 @@
>  MODULE_LICENSE("GPL");
>  
>  
> -static uid_t asus_uid = 0;
> -static gid_t asus_gid = 0;
> +static uid_t asus_uid;
> +static gid_t asus_gid;
>  MODULE_PARM(asus_uid, "i");
>  MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
>  MODULE_PARM(asus_gid, "i");

We certainly *don't* want to do that, last time I checked C did not
actually guarantee to zero out uninitialized variables -- unless it's
different in the kernelspace. Are you sure pointers are initialized as
NULLs?

Len, I'll prepare a 0.27 patch against bk, so you might want to wait for
that instead of reverting the change.

Best regards,

-- 
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]     ` <20040127150954.GA12740-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
@ 2004-01-27 15:15       ` Jes Sorensen
       [not found]         ` <16406.32889.922823.45313-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>
  2004-01-27 15:43       ` Matthew Wilcox
  2004-01-27 20:04       ` Nate Lawson
  2 siblings, 1 reply; 13+ messages in thread
From: Jes Sorensen @ 2004-01-27 15:15 UTC (permalink / raw)
  To: Karol Kozimor
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

>>>>> "Karol" == Karol Kozimor <sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org> writes:

Karol> We certainly *don't* want to do that, last time I checked C did
Karol> not actually guarantee to zero out uninitialized variables --
Karol> unless it's different in the kernelspace. Are you sure pointers
Karol> are initialized as NULLs?

Yes,

We definately want to do this, this *is* how it works within the
kernel.

Karol> Len, I'll prepare a 0.27 patch against bk, so you might want to
Karol> wait for that instead of reverting the change.

Don't reverse this change.

Thank you,
Jes


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]         ` <16406.32889.922823.45313-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>
@ 2004-01-27 15:31           ` John Belmonte
       [not found]             ` <40168442.7020806-wanGne27zNesTnJN9+BGXg@public.gmane.org>
  2004-01-27 21:29           ` Karol Kozimor
  1 sibling, 1 reply; 13+ messages in thread
From: John Belmonte @ 2004-01-27 15:31 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: Karol Kozimor, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

Jes Sorensen wrote:
>"Karol" == Karol Kozimor <sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org> writes:
> Karol> We certainly *don't* want to do that, last time I checked C did
> Karol> not actually guarantee to zero out uninitialized variables --
> Karol> unless it's different in the kernelspace. Are you sure pointers
> Karol> are initialized as NULLs?
> 
> Yes,
> 
> We definately want to do this, this *is* how it works within the
> kernel.

That may be the case, but in the process I think you are destroying 
vital information about which variables the code depends on being 
initialized to zero.  If the Linux kernel ever changed its policy, or if 
the code was used in something other than the Linux kernel (perhaps even 
being translated to some other computer language), you would need that 
information again.

I suggest commenting out the assignment instead of deleting it:

     static int foo /*= 0*/;

-John



-- 
http:// if  ile.org/


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]             ` <40168442.7020806-wanGne27zNesTnJN9+BGXg@public.gmane.org>
@ 2004-01-27 15:35               ` Jes Sorensen
       [not found]                 ` <16406.34107.51859.924117-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>
  2004-01-30 14:54               ` Matthew Wilcox
  1 sibling, 1 reply; 13+ messages in thread
From: Jes Sorensen @ 2004-01-27 15:35 UTC (permalink / raw)
  To: John Belmonte
  Cc: Karol Kozimor, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

>>>>> "John" == John Belmonte <john-wanGne27zNesTnJN9+BGXg@public.gmane.org> writes:

John> Jes Sorensen wrote:
>> We definately want to do this, this *is* how it works within the
>> kernel.

John> That may be the case, but in the process I think you are
John> destroying vital information about which variables the code
John> depends on being initialized to zero.  If the Linux kernel ever
John> changed its policy, or if the code was used in something other
John> than the Linux kernel (perhaps even being translated to some other
John> computer language), you would need that information again.

Not at all, it's standard Linux kernel convention, it won't
change. Explicitly zeroing out variables cause more damage since it
transfers them to the data segment from the bss segment.

John> I suggest commenting out the assignment instead of deleting it:

John>      static int foo /*= 0*/;

It works, IMHO it's ugly, but if you find it helps, go ahead. I'd rather
leave a comment like /* uninitialized global variables automatically go
to the bss and get zeroed out */

Jes


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]     ` <20040127150954.GA12740-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
  2004-01-27 15:15       ` Jes Sorensen
@ 2004-01-27 15:43       ` Matthew Wilcox
       [not found]         ` <20040127154314.GY11844-+pPCBgu9SkPzIGdyhVEDUDl5KyyQGfY2kSSpQ9I8OhVaa/9Udqfwiw@public.gmane.org>
  2004-01-27 20:04       ` Nate Lawson
  2 siblings, 1 reply; 13+ messages in thread
From: Matthew Wilcox @ 2004-01-27 15:43 UTC (permalink / raw)
  To: Jes Sorensen, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

On Tue, Jan 27, 2004 at 04:09:55PM +0100, Karol Kozimor wrote:
> > -static uid_t asus_uid = 0;
> > -static gid_t asus_gid = 0;
> > +static uid_t asus_uid;
> > +static gid_t asus_gid;
> 
> We certainly *don't* want to do that, last time I checked C did not
> actually guarantee to zero out uninitialized variables -- unless it's
> different in the kernelspace. Are you sure pointers are initialized as
> NULLs?

Looks like you checked the wrong standard then.  Global variables are
guaranteed to be zeroed, stack variables (ie function-local) have the
behaviour you described.  Jes' patch is correct.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]         ` <20040127154314.GY11844-+pPCBgu9SkPzIGdyhVEDUDl5KyyQGfY2kSSpQ9I8OhVaa/9Udqfwiw@public.gmane.org>
@ 2004-01-27 16:44           ` Yury V. Umanets
  0 siblings, 0 replies; 13+ messages in thread
From: Yury V. Umanets @ 2004-01-27 16:44 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: Jes Sorensen, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

On Tue, 2004-01-27 at 18:43, Matthew Wilcox wrote:
> On Tue, Jan 27, 2004 at 04:09:55PM +0100, Karol Kozimor wrote:
> > > -static uid_t asus_uid = 0;
> > > -static gid_t asus_gid = 0;
> > > +static uid_t asus_uid;
> > > +static gid_t asus_gid;
> > 
> > We certainly *don't* want to do that, last time I checked C did not
> > actually guarantee to zero out uninitialized variables -- unless it's
> > different in the kernelspace. Are you sure pointers are initialized as
> > NULLs?
> 
> Looks like you checked the wrong standard then.  Global variables are
> guaranteed to be zeroed, stack variables (ie function-local) have the
> behaviour you described.  Jes' patch is correct.

Global uninitialized variables should be located in BSS section of ELF. 

Then somebody should initialize BSS at the start of a program. In user
space this is done by crt.* small objects written in assembler and
built-in to each application by gcc.

In kernel space this should be done by kernel itself. And I guess, this
is done. So, I don't see any reasons to initialize global variables and
thus to make kernel data segment bigger...


-- 
umka



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]     ` <20040127150954.GA12740-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
  2004-01-27 15:15       ` Jes Sorensen
  2004-01-27 15:43       ` Matthew Wilcox
@ 2004-01-27 20:04       ` Nate Lawson
       [not found]         ` <20040127120357.X37323-Y6VGUYTwhu0@public.gmane.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Nate Lawson @ 2004-01-27 20:04 UTC (permalink / raw)
  To: Karol Kozimor
  Cc: Jes Sorensen, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

On Tue, 27 Jan 2004, Karol Kozimor wrote:
> Thus wrote Jes Sorensen:
> > diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c linux-2.6.1-mm3/drivers/acpi/asus_acpi.c
> > --- orig/linux-2.6.1-mm3-boot/drivers/acpi/asus_acpi.c	Wed Dec 17 18:58:39 2003
> > +++ linux-2.6.1-mm3/drivers/acpi/asus_acpi.c	Wed Jan 14 05:00:01 2004
> > @@ -73,8 +73,8 @@
> >  MODULE_LICENSE("GPL");
> >
> >
> > -static uid_t asus_uid = 0;
> > -static gid_t asus_gid = 0;
> > +static uid_t asus_uid;
> > +static gid_t asus_gid;
> >  MODULE_PARM(asus_uid, "i");
> >  MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
> >  MODULE_PARM(asus_gid, "i");
>
> We certainly *don't* want to do that, last time I checked C did not
> actually guarantee to zero out uninitialized variables -- unless it's
> different in the kernelspace. Are you sure pointers are initialized as
> NULLs?

Static variables have always been guaranteed to be initialized to 0, at
least since K&R.

-Nate


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]         ` <20040127120357.X37323-Y6VGUYTwhu0@public.gmane.org>
@ 2004-01-27 20:07           ` Karol Kozimor
  0 siblings, 0 replies; 13+ messages in thread
From: Karol Kozimor @ 2004-01-27 20:07 UTC (permalink / raw)
  To: Nate Lawson
  Cc: Jes Sorensen, acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

Thus wrote Nate Lawson:
> > We certainly *don't* want to do that, last time I checked C did not
> > actually guarantee to zero out uninitialized variables -- unless it's
> > different in the kernelspace. Are you sure pointers are initialized as
> > NULLs?
> Static variables have always been guaranteed to be initialized to 0, at
> least since K&R.

Right, that's what I was after -- I might have overreacted initially.
The patch seems fine anyway.
Best regards,

-- 
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]         ` <16406.32889.922823.45313-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>
  2004-01-27 15:31           ` John Belmonte
@ 2004-01-27 21:29           ` Karol Kozimor
  1 sibling, 0 replies; 13+ messages in thread
From: Karol Kozimor @ 2004-01-27 21:29 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

Thus wrote Jes Sorensen:
> Karol> Len, I'll prepare a 0.27 patch against bk, so you might want to
> Karol> wait for that instead of reverting the change.
> Don't reverse this change.

As I've said earlier, I'm fine with the patch. I should definitely get 
some sleep though.
Best regards,

-- 
Karol 'sziwan' Kozimor
sziwan-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]                 ` <16406.34107.51859.924117-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>
@ 2004-01-30  7:09                   ` Nate Lawson
  0 siblings, 0 replies; 13+ messages in thread
From: Nate Lawson @ 2004-01-30  7:09 UTC (permalink / raw)
  To: Jes Sorensen
  Cc: John Belmonte, Karol Kozimor,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Tue, 27 Jan 2004, Jes Sorensen wrote:
> >>>>> "John" == John Belmonte <john-wanGne27zNesTnJN9+BGXg@public.gmane.org> writes:
>
> John> Jes Sorensen wrote:
> >> We definately want to do this, this *is* how it works within the
> >> kernel.
>
> John> That may be the case, but in the process I think you are
> John> destroying vital information about which variables the code
> John> depends on being initialized to zero.  If the Linux kernel ever
> John> changed its policy, or if the code was used in something other
> John> than the Linux kernel (perhaps even being translated to some other
> John> computer language), you would need that information again.
>
> Not at all, it's standard Linux kernel convention, it won't
> change. Explicitly zeroing out variables cause more damage since it
> transfers them to the data segment from the bss segment.
>
> John> I suggest commenting out the assignment instead of deleting it:
>
> John>      static int foo /*= 0*/;
>
> It works, IMHO it's ugly, but if you find it helps, go ahead. I'd rather
> leave a comment like /* uninitialized global variables automatically go
> to the bss and get zeroed out */

I think you should have spelled that as:
/* http://www.eskimo.com/~scs/C-faq/top.html */

If you're translating code to another language, it's a good idea to know
how to use the original language.  This is not a Linux convention, it's
part of the K&R and ANSI standards for C and has been around at least 20
years, probably 30.

-Nate


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

* Re: [patch] remove null-ifiers
       [not found]             ` <40168442.7020806-wanGne27zNesTnJN9+BGXg@public.gmane.org>
  2004-01-27 15:35               ` Jes Sorensen
@ 2004-01-30 14:54               ` Matthew Wilcox
  1 sibling, 0 replies; 13+ messages in thread
From: Matthew Wilcox @ 2004-01-30 14:54 UTC (permalink / raw)
  To: John Belmonte
  Cc: Jes Sorensen, Karol Kozimor,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	len.brown-ral2JQCrhuEAvxtiuMwx3w

On Tue, Jan 27, 2004 at 10:31:14AM -0500, John Belmonte wrote:
> That may be the case, but in the process I think you are destroying 
> vital information about which variables the code depends on being 
> initialized to zero.  If the Linux kernel ever changed its policy, or if 
> the code was used in something other than the Linux kernel (perhaps even 
> being translated to some other computer language), you would need that 
> information again.

No.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn

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

end of thread, other threads:[~2004-01-30 14:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-14 13:15 [patch] remove null-ifiers Jes Sorensen
     [not found] ` <E1AgkrW-00080w-00-uLT3q8aHQDsX9StFTm9pZA@public.gmane.org>
2004-01-26 20:58   ` Len Brown
2004-01-27 15:09   ` Karol Kozimor
     [not found]     ` <20040127150954.GA12740-DETuoxkZsSqrDJvtcaxF/A@public.gmane.org>
2004-01-27 15:15       ` Jes Sorensen
     [not found]         ` <16406.32889.922823.45313-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>
2004-01-27 15:31           ` John Belmonte
     [not found]             ` <40168442.7020806-wanGne27zNesTnJN9+BGXg@public.gmane.org>
2004-01-27 15:35               ` Jes Sorensen
     [not found]                 ` <16406.34107.51859.924117-4mDQ13Tdud8Jw5R7aSpS0dP8p4LwMBBS@public.gmane.org>
2004-01-30  7:09                   ` Nate Lawson
2004-01-30 14:54               ` Matthew Wilcox
2004-01-27 21:29           ` Karol Kozimor
2004-01-27 15:43       ` Matthew Wilcox
     [not found]         ` <20040127154314.GY11844-+pPCBgu9SkPzIGdyhVEDUDl5KyyQGfY2kSSpQ9I8OhVaa/9Udqfwiw@public.gmane.org>
2004-01-27 16:44           ` Yury V. Umanets
2004-01-27 20:04       ` Nate Lawson
     [not found]         ` <20040127120357.X37323-Y6VGUYTwhu0@public.gmane.org>
2004-01-27 20:07           ` Karol Kozimor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox