[Bug 1666] New: libmisc/stackchk/check.c: unclean code

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Tue Aug 10 03:40:09 UTC 2010


https://www.rtems.org/bugzilla/show_bug.cgi?id=1666

           Summary: libmisc/stackchk/check.c: unclean code
           Product: RTEMS
           Version: 4.10
          Platform: All
        OS/Version: RTEMS
            Status: NEW
          Severity: normal
          Priority: P3
         Component: cpukit
        AssignedTo: joel.sherrill at oarcorp.com
        ReportedBy: ralf.corsepius at rtems.org


Another serious warning GCC emits:

../../../../../../c/src/../../cpukit/libmisc/stackchk/check.c:413: warning:
'stack' may be used uninitialized in this function
../../../../../../c/src/../../cpukit/libmisc/stackchk/check.c:384: warning:
'low' may be used uninitialized in this function

The code in question reads:

  void           *low;
..
  Stack_Control  *stack;
..
  #if (CPU_ALLOCATE_INTERRUPT_STACK == TRUE)
    if (the_thread == (Thread_Control *) -1) {
      if (!Stack_check_Interrupt_stack.area)  
        return;
      stack = &Stack_check_Interrupt_stack;
      the_thread = 0;
      current = 0;   
    } else 
  #else    
    {      
      stack  = &the_thread->Start.Initial_stack;
      current = (void *)_CPU_Context_Get_SP( &the_thread->Registers );
    }
  #endif
  low  = Stack_check_usable_stack_start(stack);
  size = Stack_check_usable_stack_size(stack); 

...

I.e. stack will be uninitialized in case
CPU_ALLOCATE_INTERRUPT_STACK == TRUE
and if the_thread != -1

No idea how to fix this.

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list