Skip to contentSkip to conversation

kernel/printk.c problem

DISCUSSION Scott A McConnell 4 participants 5 messages Apr 17, 2001 – Apr 18, 2001 MIPS

lore
Share & tools
lore
#0 lore raw

struct console *console_drivers = NULL; <----
Need the NULL.

Otherwise, bad things can happen on the following statement in printk

~line 311

       if ((c->flags & CON_ENABLED) && c->write){

Scott

#1 lore raw
Quoted 8 lines · Scott A McConnell

struct console *console_drivers = NULL; <----
Need the NULL.

Otherwise, bad things can happen on the following statement in printk

~line 311

       if ((c->flags & CON_ENABLED) && c->write){

Current policy is not explicitly initializing variables to zero. If this causes problems, there's a bug in the routine that clears the BSS on kernel entry.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven ------------- Sony Software Development Center Europe (SDCE) [email protected] ------------------- Sint-Stevens-Woluwestraat 55 Voice +32-2-7248626 Fax +32-2-7262686 ---------------- B-1130 Brussels, Belgium

#2 lore raw
Quoted 2 lines · Geert Uytterhoeven

Current policy is not explicitly initializing variables to zero. If this causes problems, there's a bug in the routine that clears the BSS on kernel entry.

What a man! You can debug my code from 6000 + miles away without even seeing it ;-)

#3 lore raw
In reply to Geert Uytterhoeven
Quoted 5 lines · Geert Uytterhoeven
Quoted 3 lines · Scott A McConnell

struct console *console_drivers = NULL; <----
Need the NULL.

Quoted 9 lines
Quoted 5 lines

Otherwise, bad things can happen on the following statement in printk

~line 311

       if ((c->flags & CON_ENABLED) && c->write){

Current policy is not explicitly initializing variables to zero. If this causes problems, there's a bug in the routine that clears the BSS on kernel entry.

Interesting. What is the reason behind the policy? Is that because initialized variable are put in a different section that takes more size in the image?

Jun

#4 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"jun" == Jun Sun <[email protected]> writes:

Quoted 7 lines · jun> Geert Uytterhoeven wrote:
Quoted 7 lines · Scott A McConnell
Quoted 5 lines

struct console *console_drivers = NULL; <----
Need the NULL.

Otherwise, bad things can happen on the following statement in printk

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

~line 311

       if ((c->flags & CON_ENABLED) && c->write){

Current policy is not explicitly initializing variables to zero. If this causes problems, there's a bug in the routine that clears the BSS on kernel entry.

jun> Interesting. What is the reason behind the policy? Is that because jun> initialized variable are put in a different section that takes more size in jun> the image?

Yes. In linux the BSS section (aka non explicitely initialized vars) is initializated with 0. The initialzed variables need to be in the data section of the kernel image (what only adds size, nothing else).

Later, Juan.

Signature · 2 lines
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy