From patchwork Tue Apr 7 17:25:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1267528 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) 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-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48xZ733YKRz9sPF; Wed, 8 Apr 2020 03:25: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 1jLrye-0004bB-UM; Tue, 07 Apr 2020 17:25:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLrye-0004b5-31 for fwts-devel@lists.ubuntu.com; Tue, 07 Apr 2020 17:25:32 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jLryd-0004kC-Pu; Tue, 07 Apr 2020 17:25:31 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: gpedump: ensure buf is set on default case Date: Tue, 7 Apr 2020 18:25:31 +0100 Message-Id: <20200407172531.920263-1-colin.king@canonical.com> X-Mailer: git-send-email 2.25.1 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 There is no default case in the switch statement and Coverity is complaining that buffer buf is not being initialized. Cater for this unlikely eventuality. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/gpedump/gpedump.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/acpi/gpedump/gpedump.c b/src/acpi/gpedump/gpedump.c index 38e03149..faf69bdf 100644 --- a/src/acpi/gpedump/gpedump.c +++ b/src/acpi/gpedump/gpedump.c @@ -85,6 +85,9 @@ static void gpu_dump_gpes( n++; snprintf(buf, sizeof(buf), "notifies %" PRIu32 " devices", n); break; + default: + strncpy(buf, "unknown", sizeof(buf)); + break; } fwts_log_info_verbatim(fw, " GPE 0x%2.2" PRIx8 ":", gpe_block_info->BlockBaseNumber + gpe);