Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [bug report] [MIPS] IP22: Fix serial console detection
@ 2016-12-08 21:39 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-12-08 21:39 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips

[ 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-08 21:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08 21:39 [bug report] [MIPS] IP22: Fix serial console detection Dan Carpenter

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