Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: matthias.bgg@kernel.org
Cc: geoff@infradead.org, bhupesh.linux@gmail.com,
	kexec@lists.infradead.org, Matthias Brugger <mbrugger@suse.com>
Subject: Re: [PATCH v2] arm64: Add purgatory printing
Date: Tue, 29 Sep 2020 18:20:42 +0200	[thread overview]
Message-ID: <20200929162042.GG7355@vergenet.net> (raw)
In-Reply-To: <20200923104802.17964-1-matthias.bgg@kernel.org>

On Wed, Sep 23, 2020 at 12:48:02PM +0200, matthias.bgg@kernel.org wrote:
> From: Matthias Brugger <mbrugger@suse.com>
> 
> Add option to allow purgatory printing on arm64 hardware
> by passing the console name which should be used.
> Based on a patch by Geoff Levand.
> 
> Cc: Geoff Levand <geoff@infradead.org>
> Signed-off-by: Matthias Brugger <mbrugger@suse.com>

...

> +/**
> + * find_purgatory_sink - Find a sink for purgatory output.
> + */
> +
> +static uint64_t find_purgatory_sink(const char *console)
> +{
> +	int fd, ret;
> +	char device[255], mem[255];
> +	struct stat sb;
> +	char buffer[10];
> +	uint64_t iomem = 0x0;
> +
> +	if (!console)
> +		return 0;
> +
> +	snprintf(device, sizeof(device), "/sys/class/tty/%s", console);
> +	if (stat(device, &sb) || !S_ISDIR(sb.st_mode)) {
> +		fprintf(stderr, "kexec: %s: No valid console found for %s\n",
> +			__func__, device);
> +		return 0;
> +	}

As per "[PATCH] kexec: Fix snprintf related compilation warning",
I think we should be checking the output of snprintf.

> +
> +	snprintf(mem, sizeof(mem), "%s%s", device, "/iomem_base");
> +	printf("console memory read from %s\n", mem);
> +
> +	fd = open(mem, O_RDONLY);
> +	if (fd < 0) {
> +		fprintf(stderr, "kexec: %s: No able to open %s\n",
> +			__func__, mem);
> +		return 0;
> +	}

...

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

      reply	other threads:[~2020-09-29 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 10:48 [PATCH v2] arm64: Add purgatory printing matthias.bgg
2020-09-29 16:20 ` Simon Horman [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=20200929162042.GG7355@vergenet.net \
    --to=horms@verge.net.au \
    --cc=bhupesh.linux@gmail.com \
    --cc=geoff@infradead.org \
    --cc=kexec@lists.infradead.org \
    --cc=matthias.bgg@kernel.org \
    --cc=mbrugger@suse.com \
    /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