"Issue" in termiosinitialize.c

Till Straumann strauman at slac.stanford.edu
Fri Oct 15 21:23:15 UTC 2004


AFAIK, there is a lot of code that assumes
uninitialized data (not malloc()ed) is zero
at startup.

It is definitely a bug not to zero bss, of course.

-- Till

Smith, Gene wrote:
> This may or may not arise to the level of a bug. The problem was that I 
> had forgotten to zero out bss section at startup. The function
> 
> cpukit/libcsupport/src/termiosinitialze.c
> 
> defines a global variable that, in the same file, is assumed to be zero 
> at startup. Since uninitialized data was not zero'd the termios init 
> failed for me.
> 
> If the variable rtems_termios_ttyMutex had been explicitly set to zero 
> when defined it would not have mattered if bss was zero'd.
> 
> Bug or not a bug?
> 
> Diff attached.
> 
> -gene
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --- termiosinitialize.c	2003-09-04 14:46:58.000000000 -0400
> +++ termiosinitialize-fixed.c	2004-10-15 16:49:56.000000000 -0400
> @@ -31,7 +31,7 @@
>  
>  struct rtems_termios_tty *rtems_termios_ttyHead;
>  struct rtems_termios_tty *rtems_termios_ttyTail;
> -rtems_id rtems_termios_ttyMutex;
> +rtems_id rtems_termios_ttyMutex = 0; /* assumed to be zero at startup */
>  
>  void
>  rtems_termios_initialize (void)
> 





More information about the users mailing list