Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org
Subject: [bug report] [MIPS] IP22: Fix serial console detection
Date: Fri, 9 Dec 2016 00:39:55 +0300	[thread overview]
Message-ID: <20161208213955.GA25569@elgon.mountain> (raw)

[ 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

                 reply	other threads:[~2016-12-08 21:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161208213955.GA25569@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox