Re: [PATCH v2] arm64: Add purgatory printing

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

 



On Wed, Sep 23, 2020 at 12:48:02PM +0200, matthias.bgg@xxxxxxxxxx wrote:
> From: Matthias Brugger <mbrugger@xxxxxxxx>
> 
> 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@xxxxxxxxxxxxx>
> Signed-off-by: Matthias Brugger <mbrugger@xxxxxxxx>

...

> +/**
> + * 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux