public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] pxe: automatically add console= to bootargs when not specified in append
Date: Fri, 01 Aug 2014 13:01:10 -0600	[thread overview]
Message-ID: <53DBE3F6.6060300@wwwdotorg.org> (raw)
In-Reply-To: <1406879180-12278-1-git-send-email-hdegoede@redhat.com>

On 08/01/2014 01:46 AM, Hans de Goede wrote:
> From: Dennis Gilmore <dennis@ausil.us>
>
> if there is a console variable in the u-boot environment and not one on
> the append line from syslinux config add what is in the environment to
> the bootargs.
>
> This is necessary to allow distros to have a single extlinux/extlinux.conf
> file which will work on multiple boards, even if these boards have different
> consoles (e.g. ttyS0 vs ttyAMA0).

> diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c

I know you rejected this afterwards, but since I read the patch before 
the reply, a couple of comments for anyone who finds this code in the 
archived and wants to copy it:

> +	char console[30] = "";

> -	if (label->append)
> +	if (label->append) {
>   		len += strlen(label->append);
> +		/* If no console in append and $console is set, use it */
> +		if (!strstr(label->append, "console=") && getenv("console")) {

This would get a false positive match for the text fooconsole= in the 
existing command-line. It might be better to strtok() (or similar) the 
existing value, so it can guarantee to match only options that start 
with console= not that contain console=.

> +			sprintf(console, " console=%s", getenv("console"));

This should check for buffer overflows, e.g. use snprintf().

      parent reply	other threads:[~2014-08-01 19:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  7:46 [U-Boot] [PATCH] pxe: automatically add console= to bootargs when not specified in append Hans de Goede
2014-08-01  8:20 ` Hans de Goede
2014-08-01  8:35   ` Hans de Goede
2014-08-01 19:01 ` Stephen Warren [this message]

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=53DBE3F6.6060300@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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