[bug report] [MIPS] IP22: Fix serial console detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ ancient code... ]

Hello Ralf Baechle,

This is a semi-automatic email about new static checker warnings.

The patch e9feeb207e55: "[MIPS] IP22: Fix serial console detection" 
from Jan 30, 2006, leads to the following Smatch complaint:

arch/mips/sgi-ip22/ip22-setup.c:71 plat_mem_setup()
	 error: we previously assumed 'ctype' could be null (see line 66)

arch/mips/sgi-ip22/ip22-setup.c
    56          /* ARCS console environment variable is set to "g?" for
    57           * graphics console, it is set to "d" for the first serial
    58           * line and "d2" for the second serial line.
    59           *
    60           * Need to check if the case is 'g' but no keyboard:
    61           * (ConsoleIn/Out = serial)
    62           */
    63          ctype = ArcGetEnvironmentVariable("console");
    64          cserial = ArcGetEnvironmentVariable("ConsoleOut");
    65	
    66		if ((ctype && *ctype == 'd') || (cserial && *cserial == 's')) {
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
Assumed ctype is NULL and *cserial == 's'.

    67			static char options[8] __initdata;
    68			char *baud = ArcGetEnvironmentVariable("dbaud");
    69			if (baud)
    70				strcpy(options, baud);
    71			add_preferred_console("ttyS", *(ctype + 1) == '2' ? 1 : 0,
                                                      ^^^^^^^^^^^^
Then we dereference it here.

    72					      baud ? options : NULL);
    73		} else if (!ctype || *ctype != 'g') {

regards,
dan carpenter




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux