From patchwork Wed Aug 15 13:11:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xN5s8kz9ryt; Wed, 15 Aug 2018 23:11:35 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaG-0003kT-Bt; Wed, 15 Aug 2018 13:11:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaF-0003jx-3p for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:31 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaE-000862-Ol; Wed, 15 Aug 2018 13:11:30 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 01/27] lib: fwts_framework: ensure src pointer is const Date: Wed, 15 Aug 2018 14:11:03 +0100 Message-Id: <20180815131129.24146-2-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King We are reading src from a const static string, so make src pointer const char *. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_framework.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index f6e7b72e..60b9bd66 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -286,7 +286,8 @@ static void fwts_framework_show_tests_categories(void) for (i = 0; categories[i].title != NULL; i++) { if (categories[i].flag & test->flags) { - char *src = (char *)categories[i].title, *dst; + const char *src = (const char *)categories[i].title; + char *dst; size_t len = strlen(src) + 1; char buf[len]; From patchwork Wed Aug 15 13:11:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957871 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xQ0yHSz9sCS; Wed, 15 Aug 2018 23:11:37 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaI-0003m9-OT; Wed, 15 Aug 2018 13:11:34 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaF-0003k3-Ia for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:31 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaF-000866-8e; Wed, 15 Aug 2018 13:11:31 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 02/27] fwts_framework: no need to pass tests_to_skip as it is locally scoped Date: Wed, 15 Aug 2018 14:11:04 +0100 Message-Id: <20180815131129.24146-3-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King List tests_to_skip is locally scoped in the source, so there is no need to pass it as an argument into a couple of functions. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_framework.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 60b9bd66..47299ef4 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -984,11 +984,11 @@ static void fwts_framework_heading_info( * fwts_framework_skip_test() * try to find a test in list of tests to be skipped, return NULL of cannot be found */ -static fwts_framework_test *fwts_framework_skip_test(fwts_list *tests_to_skip, fwts_framework_test *test) +static fwts_framework_test *fwts_framework_skip_test(fwts_framework_test *test) { fwts_list_link *item; - fwts_list_foreach(item, tests_to_skip) + fwts_list_foreach(item, &tests_to_skip) if (test == fwts_list_data(fwts_framework_test *, item)) return test; @@ -999,7 +999,7 @@ static fwts_framework_test *fwts_framework_skip_test(fwts_list *tests_to_skip, f * fwts_framework_skip_test_parse() * parse optarg of comma separated list of tests to skip */ -static int fwts_framework_skip_test_parse(const char *arg, fwts_list *tests_to_skip) +static int fwts_framework_skip_test_parse(const char *arg) { char *str; char *token; @@ -1011,7 +1011,7 @@ static int fwts_framework_skip_test_parse(const char *arg, fwts_list *tests_to_s fprintf(stderr, "No such test '%s'\n", token); return FWTS_ERROR; } else - fwts_list_append(tests_to_skip, test); + fwts_list_append(&tests_to_skip, test); } return FWTS_OK; @@ -1249,7 +1249,7 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar | FWTS_FLAG_SHOW_PROGRESS_DIALOG; break; case 24: /* --skip-test */ - if (fwts_framework_skip_test_parse(optarg, &tests_to_skip) != FWTS_OK) + if (fwts_framework_skip_test_parse(optarg) != FWTS_OK) return FWTS_COMPLETE; break; case 25: /* --quiet */ @@ -1404,7 +1404,7 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar fw->flags |= FWTS_FLAG_SHOW_TESTS; break; case 'S': /* --skip-test */ - if (fwts_framework_skip_test_parse(optarg, &tests_to_skip) != FWTS_OK) + if (fwts_framework_skip_test_parse(optarg) != FWTS_OK) return FWTS_COMPLETE; break; case 't': /* --table-path */ @@ -1569,7 +1569,7 @@ int fwts_framework_args(const int argc, char **argv) goto tidy; } - if (fwts_framework_skip_test(&tests_to_skip, test) == NULL) + if (fwts_framework_skip_test(test) == NULL) fwts_list_append(&tests_to_run, test); } @@ -1582,7 +1582,7 @@ int fwts_framework_args(const int argc, char **argv) fwts_list_foreach(item, &fwts_framework_test_list) { fwts_framework_test *test = fwts_list_data(fwts_framework_test*, item); if (fw->flags & test->flags & FWTS_FLAG_RUN_ALL) - if (fwts_framework_skip_test(&tests_to_skip, test) == NULL) + if (fwts_framework_skip_test(test) == NULL) fwts_list_append(&tests_to_run, test); } From patchwork Wed Aug 15 13:11:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xN72zgz9sCP; Wed, 15 Aug 2018 23:11:36 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaH-0003l0-Ea; Wed, 15 Aug 2018 13:11:33 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaG-0003kA-1h for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:32 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaF-00086A-OJ; Wed, 15 Aug 2018 13:11:31 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 03/27] lib: fwts_framework: argument 'arg' should not be const Date: Wed, 15 Aug 2018 14:11:05 +0100 Message-Id: <20180815131129.24146-4-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King The argument 'arg' is currently const which is not correct as it can be modified by strtok. Remove this unwanted keyword. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_framework.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index 47299ef4..bedc1ee9 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -999,12 +999,12 @@ static fwts_framework_test *fwts_framework_skip_test(fwts_framework_test *test) * fwts_framework_skip_test_parse() * parse optarg of comma separated list of tests to skip */ -static int fwts_framework_skip_test_parse(const char *arg) +static int fwts_framework_skip_test_parse(char *arg) { char *str; char *token; - for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) { + for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) { fwts_framework_test *test; if ((test = fwts_framework_test_find(token)) == NULL) { @@ -1017,12 +1017,12 @@ static int fwts_framework_skip_test_parse(const char *arg) return FWTS_OK; } -static int fwts_framework_filter_error_parse(const char *arg, fwts_list *list) +static int fwts_framework_filter_error_parse(char *arg, fwts_list *list) { char *str; char *token; - for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) { + for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) { if (fwts_list_append(list, token) == NULL) { fprintf(stderr, "Out of memory parsing argument %s\n", arg); fwts_list_free_items(list, NULL); @@ -1037,14 +1037,14 @@ static int fwts_framework_filter_error_parse(const char *arg, fwts_list *list) * fwts_framework_log_type_parse() * parse optarg of comma separated log types */ -static int fwts_framework_log_type_parse(fwts_framework *fw, const char *arg) +static int fwts_framework_log_type_parse(fwts_framework *fw, char *arg) { char *str; char *token; fw->log_type = 0; - for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) { + for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) { if (!strcmp(token, "plaintext")) fw->log_type |= LOG_TYPE_PLAINTEXT; else if (!strcmp(token, "json")) @@ -1069,14 +1069,14 @@ static int fwts_framework_log_type_parse(fwts_framework *fw, const char *arg) * fwts_framework_acpica_parse() * parse optarg of comma separated acpica mode flags */ -static int fwts_framework_acpica_parse(fwts_framework *fw, const char *arg) +static int fwts_framework_acpica_parse(fwts_framework *fw, char *arg) { char *str; char *token; fw->acpica_mode = 0; - for (str = (char*)arg; (token = strtok(str, ",")) != NULL; str = NULL) { + for (str = arg; (token = strtok(str, ",")) != NULL; str = NULL) { if (!strcmp(token, "serialized")) fw->acpica_mode |= FWTS_ACPICA_MODE_SERIALIZED; else if (!strcmp(token, "slack")) From patchwork Wed Aug 15 13:11:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xS0pWtz9sCR; Wed, 15 Aug 2018 23:11:39 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaK-0003nI-9A; Wed, 15 Aug 2018 13:11:36 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaG-0003kO-Jy for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:32 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaG-00086E-6s; Wed, 15 Aug 2018 13:11:32 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 04/27] lib: fwts_log: remove const arg in fwts_log_set_field_filter Date: Wed, 15 Aug 2018 14:11:06 +0100 Message-Id: <20180815131129.24146-5-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Argument str should not be const as strtok_r can modify it; remove the const. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/include/fwts_log.h | 2 +- src/lib/src/fwts_log.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/include/fwts_log.h b/src/lib/include/fwts_log.h index 0ddcf76f..e9da27b3 100644 --- a/src/lib/include/fwts_log.h +++ b/src/lib/include/fwts_log.h @@ -129,7 +129,7 @@ int fwts_log_printf(const fwts_framework *fw, const fwts_log_field field, __attribute__((format(printf, 7, 8))); void fwts_log_newline(fwts_log *log); void fwts_log_underline(fwts_log *log, const int ch); -void fwts_log_set_field_filter(const char *str); +void fwts_log_set_field_filter(char *str); int fwts_log_set_owner(fwts_log *log, const char *owner); void fwts_log_set_format(const char *str); void fwts_log_print_fields(void); diff --git a/src/lib/src/fwts_log.c b/src/lib/src/fwts_log.c index 32406f30..5a7151ec 100644 --- a/src/lib/src/fwts_log.c +++ b/src/lib/src/fwts_log.c @@ -274,7 +274,7 @@ void fwts_log_filter_unset_field(const fwts_log_field filter) * list of field names. ~ or ^ prefix to a field name * clears a bit. */ -void fwts_log_set_field_filter(const char *str) +void fwts_log_set_field_filter(char *str) { char *saveptr; fwts_log_field field; @@ -282,7 +282,7 @@ void fwts_log_set_field_filter(const char *str) for (;; str=NULL) { char *token; - if ((token = strtok_r((char*)str, ",|", &saveptr)) == NULL) + if ((token = strtok_r(str, ",|", &saveptr)) == NULL) break; if (*token == '^' || *token == '~') { field = fwts_log_str_to_field(token+1); From patchwork Wed Aug 15 13:11:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xS1tK8z9sCW; Wed, 15 Aug 2018 23:11:40 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaK-0003nR-Fo; Wed, 15 Aug 2018 13:11:36 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaH-0003kt-8T for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:33 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaG-00086I-VA; Wed, 15 Aug 2018 13:11:33 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 05/27] lib: fwts_summary: remove redundant redefinition of fwts_summary_deinit Date: Wed, 15 Aug 2018 14:11:07 +0100 Message-Id: <20180815131129.24146-6-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King The function fwts_summary_deinit is already in fwts_summary.h, so we can remove the redundant duplicate. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_summary.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/src/fwts_summary.c b/src/lib/src/fwts_summary.c index 924e9b81..9202be3b 100644 --- a/src/lib/src/fwts_summary.c +++ b/src/lib/src/fwts_summary.c @@ -57,8 +57,6 @@ static const int summary_levels[] = { /* list of summary items per error level */ static fwts_list *fwts_summaries[SUMMARY_MAX]; -void fwts_summary_deinit(void); - /* * fwts_summary_init() * initialise From patchwork Wed Aug 15 13:11:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xW3czrz9sCP; Wed, 15 Aug 2018 23:11:43 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaN-0003q2-3n; Wed, 15 Aug 2018 13:11:39 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaH-0003l7-Vz for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:33 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaH-00086P-E5; Wed, 15 Aug 2018 13:11:33 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 06/27] lib: fwts_safe_mem: add in missing constifications Date: Wed, 15 Aug 2018 14:11:08 +0100 Message-Id: <20180815131129.24146-7-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King The pointers are const, so ensure the pointer casting is const too. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_safe_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/src/fwts_safe_mem.c b/src/lib/src/fwts_safe_mem.c index 10d4f7c5..a177a00b 100644 --- a/src/lib/src/fwts_safe_mem.c +++ b/src/lib/src/fwts_safe_mem.c @@ -104,7 +104,7 @@ int OPTIMIZE0 fwts_safe_memread(const void *src, const size_t n) int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n) { static uint32_t buffer[256]; - const uint32_t *ptr, *end = (uint32_t *)src + n; + const uint32_t *ptr, *end = (const uint32_t *)src + n; uint32_t *bufptr; const uint32_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer)); @@ -139,7 +139,7 @@ int OPTIMIZE0 fwts_safe_memread32(const void *src, const size_t n) int OPTIMIZE0 fwts_safe_memread64(const void *src, const size_t n) { static uint64_t buffer[256]; - const uint64_t *ptr, *end = (uint64_t *)src + n; + const uint64_t *ptr, *end = (const uint64_t *)src + n; uint64_t *bufptr; const uint64_t *bufend = buffer + (sizeof(buffer) / sizeof(*buffer)); From patchwork Wed Aug 15 13:11:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xS4PGSz9sCX; Wed, 15 Aug 2018 23:11:40 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaK-0003nk-Kp; Wed, 15 Aug 2018 13:11:36 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaI-0003lV-8i for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:34 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaH-00086T-Sj; Wed, 15 Aug 2018 13:11:33 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 07/27] lib: fwts_log_scan: rename function argument to avoid name shadowing Date: Wed, 15 Aug 2018 14:11:09 +0100 Message-Id: <20180815131129.24146-8-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King The argument fwts_log_scan_patterns to function fwts_log_check is shadowing the global function of the same name. Rename the function argument to avoid name shadowing confusion. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_log_scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/src/fwts_log_scan.c b/src/lib/src/fwts_log_scan.c index 9a2f0f95..2a2460e2 100644 --- a/src/lib/src/fwts_log_scan.c +++ b/src/lib/src/fwts_log_scan.c @@ -349,7 +349,7 @@ nullobj: int fwts_log_check(fwts_framework *fw, const char *table, - fwts_log_scan_func fwts_log_scan_patterns, + fwts_log_scan_func fwts_log_scan_patterns_func, fwts_log_progress_func progress, fwts_list *log, int *errors, @@ -450,7 +450,7 @@ int fwts_log_check(fwts_framework *fw, } } /* We've now collected up the scan patterns, lets scan the log for errors */ - ret = fwts_log_scan(fw, log, fwts_log_scan_patterns, progress, patterns, errors, remove_timestamp); + ret = fwts_log_scan(fw, log, fwts_log_scan_patterns_func, progress, patterns, errors, remove_timestamp); fail: for (i = 0; i < n; i++) { From patchwork Wed Aug 15 13:11:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xT1KSWz9sCn; Wed, 15 Aug 2018 23:11:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaL-0003ob-GR; Wed, 15 Aug 2018 13:11:37 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaJ-0003m3-7e for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:35 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaI-00086X-Bc; Wed, 15 Aug 2018 13:11:34 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 08/27] lib: fwts_stringextras: fix some missing constifictions Date: Wed, 15 Aug 2018 14:11:10 +0100 Message-Id: <20180815131129.24146-9-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Fix up const pointer build warnings Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/include/fwts_stringextras.h | 2 +- src/lib/src/fwts_stringextras.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/include/fwts_stringextras.h b/src/lib/include/fwts_stringextras.h index fba6688f..cd5fa822 100644 --- a/src/lib/include/fwts_stringextras.h +++ b/src/lib/include/fwts_stringextras.h @@ -24,7 +24,7 @@ void fwts_chop_newline(char *str); char *fwts_realloc_strcat(char *orig, const char *newstr); -char *fwts_string_endswith(const char *str, const char *postfix); +const char *fwts_string_endswith(const char *str, const char *postfix); void fwts_memcpy_unaligned(void *dst, const void *src, size_t n); #endif diff --git a/src/lib/src/fwts_stringextras.c b/src/lib/src/fwts_stringextras.c index a9b4c7cd..1f22224d 100644 --- a/src/lib/src/fwts_stringextras.c +++ b/src/lib/src/fwts_stringextras.c @@ -80,7 +80,7 @@ char *fwts_realloc_strcat(char *orig, const char *newstr) * see if str ends with postfix * return NULL if fails, otherwise return the matched substring */ -char* fwts_string_endswith(const char *str, const char *postfix) +const char *fwts_string_endswith(const char *str, const char *postfix) { size_t sl, pl; @@ -88,7 +88,7 @@ char* fwts_string_endswith(const char *str, const char *postfix) pl = strlen(postfix); if (pl == 0) - return (char*) str + sl; + return str + sl; if (sl < pl) return NULL; @@ -96,7 +96,7 @@ char* fwts_string_endswith(const char *str, const char *postfix) if (memcmp(str + sl - pl, postfix, pl) != 0) return NULL; - return (char*) str + sl - pl; + return str + sl - pl; } /* @@ -111,5 +111,5 @@ void fwts_memcpy_unaligned(void *dst, const void *src, size_t n) return; while (i--) - ((uint8_t*)dst)[i] = ((uint8_t*)src)[i]; + ((uint8_t *)dst)[i] = ((const uint8_t *)src)[i]; } From patchwork Wed Aug 15 13:11:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xT0GsRz9sCf; Wed, 15 Aug 2018 23:11:41 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaL-0003o6-1q; Wed, 15 Aug 2018 13:11:37 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaJ-0003mG-DA for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:35 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaI-00086b-R5; Wed, 15 Aug 2018 13:11:34 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 09/27] lib: fwts_text_list: fix up some const casting issues Date: Wed, 15 Aug 2018 14:11:11 +0100 Message-Id: <20180815131129.24146-10-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Fix some const char pointer casting warnings Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_text_list.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/src/fwts_text_list.c b/src/lib/src/fwts_text_list.c index c223afbb..4255e573 100644 --- a/src/lib/src/fwts_text_list.c +++ b/src/lib/src/fwts_text_list.c @@ -82,8 +82,8 @@ char *fwts_text_list_strstr(fwts_list *list, const char *needle) */ fwts_list *fwts_list_from_text(const char *text) { - char *ptr; - fwts_list *list; + const char *ptr; + fwts_list *list; if (text == NULL) return NULL; @@ -91,10 +91,10 @@ fwts_list *fwts_list_from_text(const char *text) if ((list = fwts_list_new()) == NULL) return NULL; - ptr = (char*)text; + ptr = text; while (*ptr) { - char *start = ptr; + const char *start = ptr; char *str; int len; From patchwork Wed Aug 15 13:11:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957881 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xX0KvGz9ryt; Wed, 15 Aug 2018 23:11:44 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaO-0003rr-8i; Wed, 15 Aug 2018 13:11:40 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaJ-0003mm-VY for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:35 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaJ-00086f-A3; Wed, 15 Aug 2018 13:11:35 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 10/27] lib: fwts_json.h: fix casting warning, add missing const Date: Wed, 15 Aug 2018 14:11:12 +0100 Message-Id: <20180815131129.24146-11-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King We need to be comparing a const pointer, add in the missing const to clean up a build warning. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/include/fwts_json.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/include/fwts_json.h b/src/lib/include/fwts_json.h index 82a0cc09..d81b60d4 100644 --- a/src/lib/include/fwts_json.h +++ b/src/lib/include/fwts_json.h @@ -29,6 +29,6 @@ * versions return NULL, so check for these. Sigh. */ #define FWTS_JSON_ERROR(ptr) \ - ( (ptr == NULL) || ((json_object*)ptr == __FWTS_JSON_ERR_PTR__) ) + ( (ptr == NULL) || ((const json_object *)ptr == __FWTS_JSON_ERR_PTR__) ) #endif From patchwork Wed Aug 15 13:11:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957882 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xX1z72z9sCS; Wed, 15 Aug 2018 23:11:44 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaN-0003rP-VH; Wed, 15 Aug 2018 13:11:39 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaK-0003mz-4G for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:36 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaJ-00086j-PQ; Wed, 15 Aug 2018 13:11:35 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 11/27] lib: fwts_coreboot_cbmen: fix missing const in cast Date: Wed, 15 Aug 2018 14:11:13 +0100 Message-Id: <20180815131129.24146-12-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Fix build warning because of a missing const in the cast. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/src/fwts_coreboot_cbmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/src/fwts_coreboot_cbmem.c b/src/lib/src/fwts_coreboot_cbmem.c index 4185338d..53e57136 100644 --- a/src/lib/src/fwts_coreboot_cbmem.c +++ b/src/lib/src/fwts_coreboot_cbmem.c @@ -151,7 +151,7 @@ static int parse_cbtable_entries( lbr_p = lbtable + i; switch (lbr_p->tag) { case LB_TAG_CBMEM_CONSOLE: { - *cbmem_console_addr = (off_t)parse_cbmem_ref((struct lb_cbmem_ref *) lbr_p).cbmem_addr; + *cbmem_console_addr = (off_t)parse_cbmem_ref((const struct lb_cbmem_ref *) lbr_p).cbmem_addr; if (*cbmem_console_addr) return 0; continue; From patchwork Wed Aug 15 13:11:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xZ1PKjz9sCD; Wed, 15 Aug 2018 23:11:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaP-0003sq-4l; Wed, 15 Aug 2018 13:11:41 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaK-0003nP-VX for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:36 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaK-00086n-8V; Wed, 15 Aug 2018 13:11:36 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 12/27] sbbr: acpitables: make function sbbr_search_acpi_tables static Date: Wed, 15 Aug 2018 14:11:14 +0100 Message-Id: <20180815131129.24146-13-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Function sbbr_search_acpi_tables is local to the source and does not need to be in the global namespace so make it static Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/sbbr/acpitables/acpitables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbbr/acpitables/acpitables.c b/src/sbbr/acpitables/acpitables.c index e6786eec..0f83747a 100644 --- a/src/sbbr/acpitables/acpitables.c +++ b/src/sbbr/acpitables/acpitables.c @@ -214,7 +214,7 @@ static const char *recommended_acpi_tables[] = { }; /* Searches ACPI tables by signature. */ -fwts_acpi_table_info *sbbr_search_acpi_tables(fwts_framework *fw, const char *signature) +static fwts_acpi_table_info *sbbr_search_acpi_tables(fwts_framework *fw, const char *signature) { uint32_t i; fwts_acpi_table_info *info; From patchwork Wed Aug 15 13:11:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957886 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xg54w9z9ryt; Wed, 15 Aug 2018 23:11:51 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaV-0003yR-Eu; Wed, 15 Aug 2018 13:11:47 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaL-0003o2-RW for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:37 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaK-00086r-N5; Wed, 15 Aug 2018 13:11:36 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 13/27] acpi: crsdump: add in missing pointer constifications Date: Wed, 15 Aug 2018 14:11:15 +0100 Message-Id: <20180815131129.24146-14-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Fix up some build warnings because of missing const casting Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/crsdump/crsdump.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/acpi/crsdump/crsdump.c b/src/acpi/crsdump/crsdump.c index abf20ce1..706677c4 100644 --- a/src/acpi/crsdump/crsdump.c +++ b/src/acpi/crsdump/crsdump.c @@ -74,7 +74,7 @@ static void crsdump_show_info( /* * CRS_BIT*() data */ - val = (uint64_t)*(uint8_t*)(data + info->offset); + val = (uint64_t)*(const uint8_t *)(data + info->offset); while (mask && ((mask & 1) == 0)) { val >>= 1; mask >>= 1; @@ -87,16 +87,16 @@ static void crsdump_show_info( */ switch (info->bitlength) { case 8: - val = (uint64_t)*(uint8_t*)(data + info->offset); + val = (uint64_t)*(const uint8_t*)(data + info->offset); break; case 16: - val = (uint64_t)*(uint16_t*)(data + info->offset); + val = (uint64_t)*(const uint16_t*)(data + info->offset); break; case 32: - val = (uint64_t)*(uint32_t*)(data + info->offset); + val = (uint64_t)*(const uint32_t*)(data + info->offset); break; case 64: - val = (uint64_t)*(uint64_t*)(data + info->offset); + val = (uint64_t)*(const uint64_t*)(data + info->offset); break; default: val = ~0; From patchwork Wed Aug 15 13:11:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957884 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xd4kPJz9ryt; Wed, 15 Aug 2018 23:11:49 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaT-0003wG-0x; Wed, 15 Aug 2018 13:11:45 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaL-0003oT-OA for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:37 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaL-00086v-6O; Wed, 15 Aug 2018 13:11:37 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 14/27] acpi: ecdt: fix some missing pointer constifications Date: Wed, 15 Aug 2018 14:11:16 +0100 Message-Id: <20180815131129.24146-15-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Clean up some build warnings by adding in missing const Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/ecdt/ecdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/acpi/ecdt/ecdt.c b/src/acpi/ecdt/ecdt.c index b0c171ed..c25b24b4 100644 --- a/src/acpi/ecdt/ecdt.c +++ b/src/acpi/ecdt/ecdt.c @@ -98,7 +98,7 @@ static int ecdt_test1(fwts_framework *fw) } /* EC_ID must be at least 1 byte long for the null terminator */ - min_length = (void *)&ecdt->ec_id[0] - (void *)ecdt; + min_length = (const void *)&ecdt->ec_id[0] - (const void *)ecdt; if (ecdt->header.length < min_length + 1) { fwts_failed(fw, LOG_LEVEL_MEDIUM, @@ -143,7 +143,7 @@ static int ecdt_test1(fwts_framework *fw) fwts_log_info_verbatim(fw, " Address 0x%16.16" PRIx64, ecdt->ec_data.address); fwts_log_info_verbatim(fw, " UID: 0x%8.8" PRIx32, ecdt->uid); fwts_log_info_verbatim(fw, " GPE_BIT: 0x%2.2" PRIx8, ecdt->gpe_bit); - fwts_log_info_verbatim(fw, " EC_ID: '%s'", (char *)ecdt->ec_id); + fwts_log_info_verbatim(fw, " EC_ID: '%s'", (const char *)ecdt->ec_id); fwts_log_nl(fw); if (fwts_acpi_init(fw) != FWTS_OK) { @@ -158,10 +158,10 @@ static int ecdt_test1(fwts_framework *fw) ACPI_BUFFER buf; ACPI_OBJECT *obj; int ret; - size_t len = strlen((char *)ecdt->ec_id) + 6; + size_t len = strlen((const char *)ecdt->ec_id) + 6; char name[len]; - snprintf(name, len, "%s._UID", (char *)ecdt->ec_id); + snprintf(name, len, "%s._UID", (const char *)ecdt->ec_id); arg_list.Count = 0; arg_list.Pointer = NULL; From patchwork Wed Aug 15 13:11:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xj6sX6z9ryt; Wed, 15 Aug 2018 23:11:53 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaY-000403-3A; Wed, 15 Aug 2018 13:11:50 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaN-0003pJ-A0 for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:39 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaL-00086z-M9; Wed, 15 Aug 2018 13:11:37 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 15/27] acpi: fadt: add in missing const to fix build warnings Date: Wed, 15 Aug 2018 14:11:17 +0100 Message-Id: <20180815131129.24146-16-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Add in missing const, cleans up warnings such as: cast discards ‘const’ qualifier from pointer target type Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/fadt/fadt.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index 6304d14c..dd31c8a0 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -596,64 +596,64 @@ static void acpi_table_check_fadt_reduced_hardware(fwts_framework *fw) fwts_log_info(fw, "CENTURY is non-zero: 0x%x", fadt->century); } - if (memcmp((void *)&fadt->x_pm1a_evt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1a_evt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, "X_PM1A_EVT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1b_evt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1b_evt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, "X_PM1B_EVT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1a_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1a_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, "X_PM1A_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1b_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1b_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, "X_PM1B_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm2_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm2_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, "X_PM2_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm_tmr_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm_tmr_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, "X_PM_TMR_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_gpe0_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_gpe0_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, "X_GPE0_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_gpe1_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_gpe1_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_info(fw, From patchwork Wed Aug 15 13:11:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xj2lDnz9sCS; Wed, 15 Aug 2018 23:11:53 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaW-0003z4-Ry; Wed, 15 Aug 2018 13:11:48 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaN-0003pm-PT for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:39 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaM-000873-4t; Wed, 15 Aug 2018 13:11:38 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 16/27] sbbr: fadt: add in missing const to fix build warnings Date: Wed, 15 Aug 2018 14:11:18 +0100 Message-Id: <20180815131129.24146-17-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Add in missing const, cleans up warnings such as: cast discards ‘const’ qualifier from pointer target type Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/sbbr/fadt/fadt.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/sbbr/fadt/fadt.c b/src/sbbr/fadt/fadt.c index 430e39da..f7e16d9a 100644 --- a/src/sbbr/fadt/fadt.c +++ b/src/sbbr/fadt/fadt.c @@ -264,64 +264,64 @@ static int fadt_sbbr_reduced_hw_test2(fwts_framework *fw) fwts_log_warning(fw, "CENTURY is non-zero: 0x%x", fadt->century); } - if (memcmp((void *)&fadt->x_pm1a_evt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1a_evt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1A_EVT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1b_evt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1b_evt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1B_EVT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1a_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1a_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1A_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm1b_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm1b_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM1B_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm2_cnt_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm2_cnt_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM2_CNT_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_pm_tmr_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_pm_tmr_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_PM_TMR_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_gpe0_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_gpe0_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, "X_GPE0_BLK is a non-zero general " "address structure."); } - if (memcmp((void *)&fadt->x_gpe1_blk, - (void *)&null_gas, + if (memcmp((const void *)&fadt->x_gpe1_blk, + (const void *)&null_gas, sizeof(fwts_acpi_gas))) { passed = false; fwts_log_warning(fw, From patchwork Wed Aug 15 13:11:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xn04tXz9sCR; Wed, 15 Aug 2018 23:11:57 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaa-00042A-Hl; Wed, 15 Aug 2018 13:11:52 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaN-0003q0-Tx for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:39 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaM-000878-JT; Wed, 15 Aug 2018 13:11:38 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 17/27] acpi: method: make function method_test_CRS_return static Date: Wed, 15 Aug 2018 14:11:19 +0100 Message-Id: <20180815131129.24146-18-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Function method_test_CRS_return is local to the source and does not need to be in the global namespace so make it static Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/method/method.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 79328306..c42ec02d 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -820,7 +820,7 @@ static int method_test_UID(fwts_framework *fw) "_UID", NULL, 0, fwts_method_test_UID_return, NULL); } -void method_test_CRS_return( +static void method_test_CRS_return( fwts_framework *fw, char *name, ACPI_BUFFER *buf, From patchwork Wed Aug 15 13:11:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957891 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xl5jmDz9sCP; Wed, 15 Aug 2018 23:11:55 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaZ-00040v-6V; Wed, 15 Aug 2018 13:11:51 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaO-0003qR-KF for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:40 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaN-00087E-2P; Wed, 15 Aug 2018 13:11:39 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 18/27] acpi: nfit: rename table to nfit_table to avoid name shadowing Date: Wed, 15 Aug 2018 14:11:20 +0100 Message-Id: <20180815131129.24146-19-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Function scan_nfit_smbios uses the argument table which shadows another table in the scope of the source. Rename table to nfit_table to avoid any shadowing and scoping confusion. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/nfit/nfit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/acpi/nfit/nfit.c b/src/acpi/nfit/nfit.c index 53c86c24..d5f23df2 100644 --- a/src/acpi/nfit/nfit.c +++ b/src/acpi/nfit/nfit.c @@ -38,7 +38,7 @@ static const uint8_t guid_virtual_device[4][16] = { { 0x88, 0x81, 0x01, 0x08, 0xcd, 0x42, 0x48, 0xbb, 0x10, 0x0f, 0x53, 0x87, 0xd5, 0x3d, 0xed, 0x3d }, }; -static fwts_acpi_table_info *table; +static fwts_acpi_table_info *nfit_table; static bool check_length(fwts_framework *fw, int actual, int min, const char *name) { if (actual < min) { @@ -96,11 +96,11 @@ static bool scan_nfit_smbios(fwts_framework *fw, int len, uint8_t *table) { static int nfit_init(fwts_framework *fw) { - if (fwts_acpi_find_table(fw, "NFIT", 0, &table) != FWTS_OK) { + if (fwts_acpi_find_table(fw, "NFIT", 0, &nfit_table) != FWTS_OK) { fwts_log_error(fw, "Cannot read ACPI tables."); return FWTS_ERROR; } - if (table == NULL || (table && table->length == 0)) { + if (nfit_table == NULL || (nfit_table && nfit_table->length == 0)) { fwts_log_error(fw, "ACPI NFIT table does not exist, skipping test"); return FWTS_SKIP; } @@ -112,7 +112,7 @@ static int nfit_init(fwts_framework *fw) */ static int nfit_test1(fwts_framework *fw) { - fwts_acpi_table_nfit *nfit = (fwts_acpi_table_nfit*) table->data; + fwts_acpi_table_nfit *nfit = (fwts_acpi_table_nfit*)nfit_table->data; fwts_acpi_table_nfit_struct_header *entry; uint32_t offset; bool passed = true; @@ -124,9 +124,9 @@ static int nfit_test1(fwts_framework *fw) fwts_acpi_reserved_zero_check(fw, "NFIT", "Reserved", nfit->reserved, sizeof(nfit->reserved), &passed); offset = sizeof(fwts_acpi_table_nfit); - entry = (fwts_acpi_table_nfit_struct_header *) (table->data + offset); + entry = (fwts_acpi_table_nfit_struct_header *)(nfit_table->data + offset); - while (offset < table->length) { + while (offset < nfit_table->length) { uint64_t reserved_passed = 0; fwts_log_info_verbatim(fw, " NFIT Subtable:"); @@ -506,7 +506,7 @@ static int nfit_test1(fwts_framework *fw) fwts_acpi_reserved_zero_check(fw, "NFIT", "Reserved", reserved_passed, sizeof(reserved_passed), &passed); fwts_log_nl(fw); offset += entry->length; - entry = (fwts_acpi_table_nfit_struct_header *) (table->data + offset); + entry = (fwts_acpi_table_nfit_struct_header *)(nfit_table->data + offset); } From patchwork Wed Aug 15 13:11:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xj2klJz9sCR; Wed, 15 Aug 2018 23:11:53 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaX-0003zf-KB; Wed, 15 Aug 2018 13:11:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaO-0003r1-76 for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:40 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaN-00087J-HC; Wed, 15 Aug 2018 13:11:39 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 19/27] acpi: wmi: add in missing const to fix build warnings Date: Wed, 15 Aug 2018 14:11:21 +0100 Message-Id: <20180815131129.24146-20-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Add in missing const, cleans up warnings. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/wmi/wmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/acpi/wmi/wmi.c b/src/acpi/wmi/wmi.c index 1bdd7975..0a5bbacb 100644 --- a/src/acpi/wmi/wmi.c +++ b/src/acpi/wmi/wmi.c @@ -299,12 +299,12 @@ static void wmi_parse_wdg_data( const uint8_t *wdg_data) { size_t i; - fwts_wdg_info *info = (fwts_wdg_info *)wdg_data; + const fwts_wdg_info *info = (const fwts_wdg_info *)wdg_data; bool all_events_known = true; bool events = false; for (i = 0; i < (size / sizeof(fwts_wdg_info)); i++, info++) { - uint8_t *guid = info->guid; + const uint8_t *guid = info->guid; char guid_str[37]; const fwts_wmi_known_guid *known; From patchwork Wed Aug 15 13:11:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957892 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xp0rSpz9sCD; Wed, 15 Aug 2018 23:11:58 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvac-000435-0p; Wed, 15 Aug 2018 13:11:54 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaP-0003s2-5a for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:41 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaO-00087N-7w; Wed, 15 Aug 2018 13:11:40 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 20/27] acpi: stao: add in missing const to fix build warnings Date: Wed, 15 Aug 2018 14:11:22 +0100 Message-Id: <20180815131129.24146-21-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Add in missing const, cleans up warnings. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/stao/stao.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/acpi/stao/stao.c b/src/acpi/stao/stao.c index 56df440b..537e364f 100644 --- a/src/acpi/stao/stao.c +++ b/src/acpi/stao/stao.c @@ -50,12 +50,12 @@ static int stao_init(fwts_framework *fw) */ static bool stao_acpi_string( fwts_framework *fw, - char *str, - char *end, + const char *str, + const char *end, bool *passed, size_t *len) { - char *ptr = str; + const char *ptr = str; while (*ptr) { if (ptr > end) { @@ -82,7 +82,7 @@ static int stao_test1(fwts_framework *fw) { const fwts_acpi_table_stao *stao = (const fwts_acpi_table_stao *)table->data; bool passed = true; - char *ptr, *end; + const char *ptr, *end; int strings = 0; if (stao->header.length > (uint32_t)table->length) { @@ -101,8 +101,8 @@ static int stao_test1(fwts_framework *fw) fwts_log_info_verbatim(fw, "STAO Status Override Table:"); fwts_log_info_verbatim(fw, " UART: 0x%2.2" PRIx8, stao->uart); - ptr = (char *)stao->namelist; - end = (char *)table->data + stao->header.length; + ptr = (const char *)stao->namelist; + end = (const char *)table->data + stao->header.length; while (ptr < end) { size_t len; @@ -118,8 +118,8 @@ static int stao_test1(fwts_framework *fw) if (!strings) goto done; - ptr = (char *)stao->namelist; - end = (char *)table->data + table->length; + ptr = (const char *)stao->namelist; + end = (const char *)table->data + table->length; while (ptr < end) { bool found; From patchwork Wed Aug 15 13:11:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xf0NgTz9sCP; Wed, 15 Aug 2018 23:11:50 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaU-0003xG-5P; Wed, 15 Aug 2018 13:11:46 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaP-0003sh-MI for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:41 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaO-00087X-Mu; Wed, 15 Aug 2018 13:11:40 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 21/27] bios: mtrr make function multi_types_check static Date: Wed, 15 Aug 2018 14:11:23 +0100 Message-Id: <20180815131129.24146-22-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Function multi_types_check is local to the source and does not need to be in the global namespace so make it static. Also remove redundant voidification of function return. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/bios/mtrr/mtrr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bios/mtrr/mtrr.c b/src/bios/mtrr/mtrr.c index ecd6204e..5dfb4a60 100644 --- a/src/bios/mtrr/mtrr.c +++ b/src/bios/mtrr/mtrr.c @@ -360,7 +360,7 @@ static int guess_cache_type( return FWTS_OK; } -void multi_types_check(fwts_framework *fw, int *type) +static void multi_types_check(fwts_framework *fw, int *type) { int n_types = 0, i; @@ -463,7 +463,7 @@ static int validate_iomem(fwts_framework *fw) type = cache_types(start, end); - (void)multi_types_check(fw, &type); + multi_types_check(fw, &type); if (guess_cache_type(fw, c2, &type_must, &type_mustnot, start) != FWTS_OK) { /* This has failed, give up at this point */ From patchwork Wed Aug 15 13:11:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957897 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xt1F2Pz9sCP; Wed, 15 Aug 2018 23:12:02 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvag-00048O-1D; Wed, 15 Aug 2018 13:11:58 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaS-0003tC-1j for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:44 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaP-00087b-5h; Wed, 15 Aug 2018 13:11:41 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 22/27] opal: reserv_mem: add in missing const to fix build warnings Date: Wed, 15 Aug 2018 14:11:24 +0100 Message-Id: <20180815131129.24146-23-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Add in missing const, cleans up warnings. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/opal/reserv_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opal/reserv_mem.c b/src/opal/reserv_mem.c index 4683f73c..b42b959b 100644 --- a/src/opal/reserv_mem.c +++ b/src/opal/reserv_mem.c @@ -125,7 +125,7 @@ static int reserv_mem_init(fwts_framework *fw) static int reserv_mem_limits_test(fwts_framework *fw) { bool ok = true; - char *region_names; + const char *region_names; const uint64_t *ranges; reserve_region_t *regions; int offset, len, nr_regions, rc, j; @@ -145,7 +145,7 @@ static int reserv_mem_limits_test(fwts_framework *fw) "reserved-names"); /* Check for the reservd-names property */ - region_names = (char *)fdt_getprop(fw->fdt, offset, + region_names = (const char *)fdt_getprop(fw->fdt, offset, "reserved-names", &len); if (!region_names) { fwts_failed(fw, LOG_LEVEL_MEDIUM, "DTPropertyMissing", From patchwork Wed Aug 15 13:11:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957896 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xs0hrBz9ryt; Wed, 15 Aug 2018 23:12:01 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvaf-00047P-7v; Wed, 15 Aug 2018 13:11:57 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaS-0003tX-24 for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:44 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaP-00087f-L3; Wed, 15 Aug 2018 13:11:41 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 23/27] hotkey: rename list 'hotkeys' to avoid name shadowing Date: Wed, 15 Aug 2018 14:11:25 +0100 Message-Id: <20180815131129.24146-24-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Rename the list 'hotkeys' to 'hotkeys_list' to avoid name shadowing confusion with various functions that use hotkeys as an argument too. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/hotkey/hotkey/hotkey.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hotkey/hotkey/hotkey.c b/src/hotkey/hotkey/hotkey.c index 79833d2e..640717cd 100644 --- a/src/hotkey/hotkey/hotkey.c +++ b/src/hotkey/hotkey/hotkey.c @@ -30,7 +30,7 @@ #define AT_KEYBOARD "AT Translated Set 2 keyboard" -static fwts_list *hotkeys; +static fwts_list *hotkeys_list; static char *hotkey_dev; static char *hotkey_keymap; @@ -215,7 +215,7 @@ static int hotkey_init(fwts_framework *fw) fwts_log_error(fw, "Cannot determine keymap for this machine."); return FWTS_ERROR; } - if ((hotkeys = fwts_keymap_load(hotkey_keymap)) == NULL) { + if ((hotkeys_list = fwts_keymap_load(hotkey_keymap)) == NULL) { fwts_log_error(fw, "Cannot load keymap for this machine."); return FWTS_ERROR; } @@ -227,7 +227,7 @@ static int hotkey_deinit(fwts_framework *fw) { FWTS_UNUSED(fw); - fwts_keymap_free(hotkeys); + fwts_keymap_free(hotkeys_list); free(hotkey_dev); free(hotkey_keymap); return FWTS_OK; @@ -241,7 +241,7 @@ static int hotkey_test1(fwts_framework *fw) "keys."); fwts_log_nl(fw); fwts_log_info(fw, "Using %s keymap and %s input device.", hotkey_keymap, hotkey_dev); - hotkey_test(fw, hotkey_dev, hotkeys); + hotkey_test(fw, hotkey_dev, hotkeys_list); fwts_infoonly(fw); From patchwork Wed Aug 15 13:11:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957895 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xq2Rg5z9sCR; Wed, 15 Aug 2018 23:11:59 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvad-000453-Ik; Wed, 15 Aug 2018 13:11:55 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaS-0003tu-3E for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:44 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaQ-00087j-3m; Wed, 15 Aug 2018 13:11:42 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 24/27] uefi: uefirtauthvar: rename argument attibutes to var_attributes Date: Wed, 15 Aug 2018 14:11:26 +0100 Message-Id: <20180815131129.24146-25-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Argument attibutes shadows the global variable name attibutes so rename it to var_attributes to avoid any variable shadowing confusion Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/uefi/uefirtauthvar/uefirtauthvar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uefi/uefirtauthvar/uefirtauthvar.c b/src/uefi/uefirtauthvar/uefirtauthvar.c index c59b0879..606bead7 100644 --- a/src/uefi/uefirtauthvar/uefirtauthvar.c +++ b/src/uefi/uefirtauthvar/uefirtauthvar.c @@ -56,7 +56,7 @@ static uint16_t variablenametest[] = {'A', 'u', 't', 'h', 'V', 'a', 'r', 'T', 'e static long setvar( EFI_GUID *guid, - uint32_t attributes, + uint32_t var_attributes, uint64_t datasize, void *data, uint64_t *status) @@ -66,7 +66,7 @@ static long setvar( setvariable.VariableName = variablenametest; setvariable.VendorGuid = guid; - setvariable.Attributes = attributes; + setvariable.Attributes = var_attributes; setvariable.DataSize = datasize; setvariable.Data = data; setvariable.status = status; From patchwork Wed Aug 15 13:11:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957894 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xq4jM7z9sCW; Wed, 15 Aug 2018 23:11:59 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvae-00045a-39; Wed, 15 Aug 2018 13:11:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaR-0003uV-Uh for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:43 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaQ-00087o-Qy; Wed, 15 Aug 2018 13:11:42 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 25/27] uefi: uefirtvariable: rename argument attibutes to var_attributes Date: Wed, 15 Aug 2018 14:11:27 +0100 Message-Id: <20180815131129.24146-26-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Argument attibutes shadows the global variable name attibutes so rename it to var_attributes to avoid any variable shadowing confusion Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/uefi/uefirtvariable/uefirtvariable.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uefi/uefirtvariable/uefirtvariable.c b/src/uefi/uefirtvariable/uefirtvariable.c index 552790e0..c3230868 100644 --- a/src/uefi/uefirtvariable/uefirtvariable.c +++ b/src/uefi/uefirtvariable/uefirtvariable.c @@ -873,7 +873,7 @@ err: static int setvariable_insertvariable( fwts_framework *fw, - const uint32_t attributes, + const uint32_t var_attributes, const uint64_t datasize, uint16_t *varname, EFI_GUID *gtestguid, @@ -892,7 +892,7 @@ static int setvariable_insertvariable( setvariable.VariableName = varname; setvariable.VendorGuid = gtestguid; - setvariable.Attributes = attributes; + setvariable.Attributes = var_attributes; setvariable.DataSize = datasize; setvariable.Data = data; setvariable.status = &status; @@ -1035,7 +1035,7 @@ static int setvariable_checkvariable_notfound( static int setvariable_invalidattr( fwts_framework *fw, - const uint32_t attributes, + const uint32_t var_attributes, const uint64_t datasize, uint16_t *varname, EFI_GUID *gtestguid, @@ -1052,7 +1052,7 @@ static int setvariable_invalidattr( setvariable.VariableName = varname; setvariable.VendorGuid = gtestguid; - setvariable.Attributes = attributes; + setvariable.Attributes = var_attributes; setvariable.DataSize = datasize; setvariable.Data = data; setvariable.status = &status; From patchwork Wed Aug 15 13:11:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957893 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xp6fc0z9sCS; Wed, 15 Aug 2018 23:11:58 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvad-000445-25; Wed, 15 Aug 2018 13:11:55 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaS-0003uk-1d for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:44 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaR-00087s-CW; Wed, 15 Aug 2018 13:11:43 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 26/27] coreboot: clog: rename list 'clog' to avoid name shadowing Date: Wed, 15 Aug 2018 14:11:28 +0100 Message-Id: <20180815131129.24146-27-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Rename the list 'clog' to 'clog_list' to avoid name shadowing confusion with various functions that use clog as an argument too. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/coreboot/clog/clog.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/coreboot/clog/clog.c b/src/coreboot/clog/clog.c index 5feca313..6f5e38ce 100644 --- a/src/coreboot/clog/clog.c +++ b/src/coreboot/clog/clog.c @@ -25,7 +25,7 @@ #include #include -static fwts_list *clog; +static fwts_list *clog_list; static int clog_init(fwts_framework *fw) { @@ -34,9 +34,8 @@ static int clog_init(fwts_framework *fw) return FWTS_SKIP; } - clog = fwts_clog_read(fw); - - if (clog == NULL) { + clog_list = fwts_clog_read(fw); + if (clog_list == NULL) { fwts_log_error(fw, "Cannot read coreboot log."); return FWTS_ERROR; } @@ -47,7 +46,7 @@ static int clog_deinit(fwts_framework *fw) { FWTS_UNUSED(fw); - fwts_clog_free(clog); + fwts_clog_free(clog_list); return FWTS_OK; } @@ -61,7 +60,7 @@ static int clog_test1(fwts_framework *fw) { int errors = 0; - if (fwts_clog_firmware_check(fw, clog_progress, clog, &errors)) { + if (fwts_clog_firmware_check(fw, clog_progress, clog_list, &errors)) { fwts_log_error(fw, "Error parsing coreboot log."); return FWTS_ERROR; } From patchwork Wed Aug 15 13:11:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 957898 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41r8xt3yQPz9sCX; Wed, 15 Aug 2018 23:12:02 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fpvag-000490-PO; Wed, 15 Aug 2018 13:11:58 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fpvaS-0003vC-F3 for fwts-devel@lists.ubuntu.com; Wed, 15 Aug 2018 13:11:44 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1fpvaR-00087w-SA; Wed, 15 Aug 2018 13:11:43 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 27/27] lib: fwts_acpi_tables: unconstify data and don't strcpy ACPI table ids Date: Wed, 15 Aug 2018 14:11:29 +0100 Message-Id: <20180815131129.24146-28-colin.king@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180815131129.24146-1-colin.king@canonical.com> References: <20180815131129.24146-1-colin.king@canonical.com> MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Although it seems a good idea to make the ACPI table data const, we may need to modify it when patching pointers if we make cached copies of the data, so unconstify it. Also, don't strncpy ACPI table IDs, instead memcpy them as they are not really strings with terminating zero bytes. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/lib/include/fwts_acpi_tables.h | 2 +- src/lib/src/fwts_acpi_tables.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/lib/include/fwts_acpi_tables.h b/src/lib/include/fwts_acpi_tables.h index d307af89..24a7b78a 100644 --- a/src/lib/include/fwts_acpi_tables.h +++ b/src/lib/include/fwts_acpi_tables.h @@ -34,7 +34,7 @@ typedef enum { typedef struct { char name[5]; - const void *data; + void *data; size_t length; uint32_t which; uint32_t index; diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index ccf0a7b1..b6d8fbe4 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -228,7 +228,7 @@ static void *fwts_acpi_load_table(const off_t addr) */ static void fwts_acpi_add_table( const char *name, /* Table Name */ - const void *table, /* Table binary blob */ + void *table, /* Table binary blob */ const uint64_t addr, /* Address of table */ const size_t length, /* Length of table */ const fwts_acpi_table_provenance provenance) @@ -1006,7 +1006,7 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw) fwts_log_error(fw, "Cannot allocate fake FACS."); return FWTS_ERROR; } - strncpy(facs->signature, "FACS", 4); + (void)memcpy(facs->signature, "FACS", 4); facs->length = size; facs->hardware_signature = 0xf000a200; /* Some signature */ facs->flags = 0; @@ -1074,13 +1074,13 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw) if (table && fwts_acpi_table_fixable(table)) rsdt->entries[j++] = (uint32_t)table->addr; - strncpy(rsdt->header.signature, "RSDT", 4); + (void)memcpy(rsdt->header.signature, "RSDT", 4); rsdt->header.length = size; rsdt->header.revision = 1; - strncpy(rsdt->header.oem_id, "FWTSID", 6); - strncpy(rsdt->header.oem_tbl_id, oem_tbl_id, 8); + (void)memcpy(rsdt->header.oem_id, "FWTSID", 6); + (void)memcpy(rsdt->header.oem_tbl_id, oem_tbl_id, 8); rsdt->header.oem_revision = 1; - strncpy(rsdt->header.creator_id, "FWTS", 4); + (void)memcpy(rsdt->header.creator_id, "FWTS", 4); rsdt->header.creator_revision = 1; rsdt->header.checksum = 256 - fwts_checksum((uint8_t*)rsdt, size); @@ -1111,13 +1111,13 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw) if (table && fwts_acpi_table_fixable(table)) xsdt->entries[j++] = table->addr; - strncpy(xsdt->header.signature, "XSDT", 4); + (void)memcpy(xsdt->header.signature, "XSDT", 4); xsdt->header.length = size; xsdt->header.revision = 2; - strncpy(xsdt->header.oem_id, "FWTSID", 6); - strncpy(xsdt->header.oem_tbl_id, oem_tbl_id, 8); + (void)memcpy(xsdt->header.oem_id, "FWTSID", 6); + (void)memcpy(xsdt->header.oem_tbl_id, oem_tbl_id, 8); xsdt->header.oem_revision = 1; - strncpy(xsdt->header.creator_id, "FWTS", 4); + (void)memcpy(xsdt->header.creator_id, "FWTS", 4); xsdt->header.creator_revision = 1; xsdt->header.checksum = 256 - fwts_checksum((uint8_t*)xsdt, size); @@ -1139,8 +1139,8 @@ static int fwts_acpi_load_tables_fixup(fwts_framework *fw) return FWTS_ERROR; } - strncpy(rsdp->signature, "RSD PTR ", 8); - strncpy(rsdp->oem_id, "FWTSID", 6); + (void)memcpy(rsdp->signature, "RSD PTR ", 8); + (void)memcpy(rsdp->oem_id, "FWTSID", 6); rsdp->revision = 2; rsdp->length = sizeof(fwts_acpi_table_rsdp); rsdp->reserved[0] = 0;