diff options
author | Nico Huber <nico.huber@secunet.com> | 2016-05-02 11:39:35 +0200 |
---|---|---|
committer | Martin Roth <martinroth@google.com> | 2017-01-13 17:32:32 +0100 |
commit | 441d2a4f33a911e47299c350e321084c59a68ddf (patch) | |
tree | 22d8dce7176b505e4d34e3c3ba59f2b531434958 | |
parent | 40ba6fd0486b9845a951dbe042b1121687353c1a (diff) | |
download | flashrom-441d2a4f33a911e47299c350e321084c59a68ddf.tar.gz flashrom-441d2a4f33a911e47299c350e321084c59a68ddf.tar.bz2 flashrom-441d2a4f33a911e47299c350e321084c59a68ddf.zip |
Make image parameter of cb_check_image const
Change-Id: I811b3d6f1710154e055b03d5f27b1a8d9b3c0a43
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/17943
Reviewed-by: Martin Roth <martinroth@google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r-- | cbtable.c | 14 | ||||
-rw-r--r-- | programmer.h | 2 |
2 files changed, 8 insertions, 8 deletions
@@ -38,13 +38,13 @@ static char *cb_vendor = NULL, *cb_model = NULL; * -1 if IDs in the image do not match the IDs embedded in the current firmware, * 0 if the IDs could not be found in the image or if they match correctly. */ -int cb_check_image(uint8_t *image, int size) +int cb_check_image(const uint8_t *image, int size) { - unsigned int *walk; + const unsigned int *walk; unsigned int mb_part_offset, mb_vendor_offset; - char *mb_part, *mb_vendor; + const char *mb_part, *mb_vendor; - walk = (unsigned int *)(image + size - 0x10); + walk = (const unsigned int *)(image + size - 0x10); walk--; if ((*walk) == 0 || ((*walk) & 0x3ff) != 0) { @@ -52,7 +52,7 @@ int cb_check_image(uint8_t *image, int size) * flash at exactly the location where coreboot image size, coreboot vendor name pointer and * coreboot board name pointer are usually stored. In this case coreboot uses an alternate * location for the coreboot image data. */ - walk = (unsigned int *)(image + size - 0x80); + walk = (const unsigned int *)(image + size - 0x80); walk--; } @@ -70,8 +70,8 @@ int cb_check_image(uint8_t *image, int size) return 0; } - mb_part = (char *)(image + size - mb_part_offset); - mb_vendor = (char *)(image + size - mb_vendor_offset); + mb_part = (const char *)(image + size - mb_part_offset); + mb_vendor = (const char *)(image + size - mb_vendor_offset); if (!isprint((unsigned char)*mb_part) || !isprint((unsigned char)*mb_vendor)) { msg_pdbg("Flash image seems to have garbage in the ID location. " diff --git a/programmer.h b/programmer.h index bd8e98d59..38534131e 100644 --- a/programmer.h +++ b/programmer.h @@ -308,7 +308,7 @@ void cleanup_cpu_msr(void); /* cbtable.c */ int cb_parse_table(const char **vendor, const char **model); -int cb_check_image(uint8_t *bios, int size); +int cb_check_image(const uint8_t *bios, int size); /* dmi.c */ #if defined(__i386__) || defined(__x86_64__) |