From patchwork Wed May 4 11:51:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Huber X-Patchwork-Id: 618394 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3r0Gg83HJ2z9sDb for ; Wed, 4 May 2016 21:54:44 +1000 (AEST) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1axvLh-0006jb-Cp; Wed, 04 May 2016 13:52:13 +0200 Received: from a.mx.secunet.com ([62.96.220.36]) by mail.coreboot.org with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.86_2) (envelope-from ) id 1axvLS-0006j9-0R for flashrom@flashrom.org; Wed, 04 May 2016 13:52:04 +0200 Received: from localhost (alg1 [127.0.0.1]) by a.mx.secunet.com (Postfix) with ESMTP id A3C241A065E for ; Wed, 4 May 2016 13:51:55 +0200 (CEST) X-Virus-Scanned: by secunet Received: from a.mx.secunet.com ([127.0.0.1]) by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AWXekfzobASg for ; Wed, 4 May 2016 13:51:54 +0200 (CEST) Received: from mail-essen-01.secunet.de (unknown [10.53.40.204]) by a.mx.secunet.com (Postfix) with ESMTP id C3FF91A05E2 for ; Wed, 4 May 2016 13:51:54 +0200 (CEST) Received: from schawa.localdomain (10.182.9.137) by mail-essen-01.secunet.de (10.53.40.204) with Microsoft SMTP Server (TLS) id 14.3.279.2; Wed, 4 May 2016 13:51:55 +0200 From: Nico Huber To: Date: Wed, 4 May 2016 13:51:33 +0200 Message-ID: <1462362706-31216-2-git-send-email-nico.huber@secunet.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1462362706-31216-1-git-send-email-nico.huber@secunet.com> References: <1462362706-31216-1-git-send-email-nico.huber@secunet.com> MIME-Version: 1.0 X-Originating-IP: [10.182.9.137] X-G-Data-MailSecurity-for-Exchange-SpamLevel: 0 X-G-Data-MailSecurity-for-Exchange-SpamFilter: 0; 1; str=0001.0A0C0202.5729E25B.01D2, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-G-Data-MailSecurity-for-Exchange-State: 0 X-G-Data-MailSecurity-for-Exchange-Error: 0 X-G-Data-MailSecurity-for-Exchange-Sender: 32 X-G-Data-MailSecurity-for-Exchange-Server: d65e63f7-5c15-413f-8f63-c0d707471c93 X-EXCLAIMER-MD-CONFIG: 2c86f778-e09b-4440-8b15-867914633a10 X-G-Data-MailSecurity-for-Exchange-Guid: BD28D1B6-C23C-4DC6-B97D-31BF4DC482DB X-Spam-Score: -1.6 (-) Subject: [flashrom] [PATCH 01/14] Make image parameter of cb_check_image() const X-BeenThere: flashrom@flashrom.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: flashrom discussion and development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: flashrom-bounces@flashrom.org Sender: "flashrom" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff Signed-off-by: Nico Huber --- cbtable.c | 14 +++++++------- programmer.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cbtable.c b/cbtable.c index 1a74e46..c1c264a 100644 --- a/cbtable.c +++ b/cbtable.c @@ -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 bd8e98d..3853413 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__)