[coreboot] [PATCH] flashrom: Improve coreboot image detection heuristic
Stefan Reinauer
stepan at coresystems.de
Fri Jul 4 19:17:59 CEST 2008
Carl-Daniel Hailfinger wrote:
> Sorry. I had a correct version, but it seems I pressed undo before saving.
>
> Fix coreboot image detection heuristic.
>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>
I wonder whether it makes sense to explicitly say !=0 for the
non-isprint parts to express that those are not booleans but checks
whether a char is 0
I'm still not sure this really shows the correct behavior, but I guess
it will compile on 64bit systems like this.
Acked-by: Stefan Reinauer <stepan at coresystems.de>
> Index: flashrom-tmp1/layout.c
> ===================================================================
> --- flashrom-tmp1/layout.c (Revision 3412)
> +++ flashrom-tmp1/layout.c (Arbeitskopie)
> @@ -65,10 +65,10 @@
> */
> if ((*walk) == 0 || ((*walk) & 0x3ff) != 0 || *walk > size ||
> *(walk - 1) > size || *(walk - 2) > size ||
> - (!isprint((const char *)(bios + size - *(walk - 1))) &&
> - ((const char *)(bios + size - *(walk - 1)))) ||
> - (!isprint((const char *)(bios + size - *(walk - 2))) &&
> - ((const char *)(bios + size - *(walk - 2))))) {
> + (!isprint(*(const char *)(bios + size - *(walk - 1))) &&
> + (*(const char *)(bios + size - *(walk - 1)))) ||
> + (!isprint(*(const char *)(bios + size - *(walk - 2))) &&
> + (*(const char *)(bios + size - *(walk - 2))))) {
> printf("Flash image seems to be a legacy BIOS. Disabling checks.\n");
> mainboard_vendor = def_name;
> mainboard_part = def_name;
>
>
>
--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.de • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
More information about the coreboot
mailing list