From patchwork Tue Apr 7 16:52:57 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: 1267524 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 48xYPX0T50z9sPF; Wed, 8 Apr 2020 02:53:04 +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 1jLrTB-0000BB-F4; Tue, 07 Apr 2020 16:53:01 +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 1jLrT8-0000Ak-Vv for fwts-devel@lists.ubuntu.com; Tue, 07 Apr 2020 16:52:58 +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 1jLrT8-0001dY-K5; Tue, 07 Apr 2020 16:52:58 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] opal: mtd_info: memset a mtd_info struct to keep static analyzers happy Date: Tue, 7 Apr 2020 17:52:57 +0100 Message-Id: <20200407165258.916007-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 Coverity throws a warning of a potential use of unitialized fields in the mtd_info struct, so memset it to zero before calling the ioctl. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/opal/mtd_info.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/opal/mtd_info.c b/src/opal/mtd_info.c index b9473edf..0af500d2 100644 --- a/src/opal/mtd_info.c +++ b/src/opal/mtd_info.c @@ -126,6 +126,7 @@ static int mtd_dev_query(fwts_framework *fw, char *mtd_devnode) return FWTS_ERROR; } + (void)memset(&mtd_info, 0, sizeof(mtd_info)); if (ioctl(fd, MEMGETINFO, &mtd_info)) { (void)close(fd); fwts_failed(fw, LOG_LEVEL_CRITICAL, "OPAL MTD Info",