From patchwork Wed Sep 22 08:54:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 1531133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=m9chcO5Y; dkim-atps=neutral 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=) 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 4HDsYC4tZ9z9s0r for ; Wed, 22 Sep 2021 18:54:22 +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 1mSy1C-0004kj-CO; Wed, 22 Sep 2021 08:54:18 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mSy1B-0004kd-EE for fwts-devel@lists.ubuntu.com; Wed, 22 Sep 2021 08:54:17 +0000 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 273D33F070; Wed, 22 Sep 2021 08:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1632300857; bh=F5dWT9lWJVeyGgWd3dY07nvfHO0rOPv9EQ+EP3I6WL8=; h=From:To:Subject:Date:Message-Id:MIME-Version:Content-Type; b=m9chcO5YAmj5tddS+wr4KUGDc3hbj5PIkRXvHesvv5PQ4LXdNrw0SoH7sGRh10zpr p93OeIC+boeVzLesn1MOZhsKqCP49Qe7gGDG2e7tGa/uuAfKTnOcULhsy/oWO15XzU V3n0QHW4VyVtUUybGvZw93vbv1h8O3Wy8UfaDFhT1/rfgyy8gKLkhnbJLsCbrIYjM6 faFTa/5WlnXlI+rsuqSz+WTNEQtfzOqD32OGIY8/wHxZBVrIoFHCLChRK4ATbW/CPe t6j4Bd0reHwaMERzAw3BtvGJBaugeR2LL3YDWWCOsdHOXyG3kfXy1tEpWqDw5yIBMp XjaOR8pIASv7w== From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] opal: mem_info: clean up pedantic static analysis warnings Date: Wed, 22 Sep 2021 09:54:16 +0100 Message-Id: <20210922085416.114900-1-colin.king@canonical.com> X-Mailer: git-send-email 2.32.0 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 Static analysis is warning that namelist may be uninitialized. Clean this up by setting the pointer to NULL. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/opal/mem_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opal/mem_info.c b/src/opal/mem_info.c index ac8631d3..03b04762 100644 --- a/src/opal/mem_info.c +++ b/src/opal/mem_info.c @@ -137,7 +137,7 @@ static int process_dimm( char *my_dir) { int count, i, failures = 0; - struct dirent **namelist; + struct dirent **namelist = NULL; bool found = false; count = scandir(my_dir, &namelist, NULL, alphasort); @@ -337,7 +337,7 @@ static int process_mba( static int get_linux_mem_devices(fwts_framework *fw) { int count, i, failures = 0; - struct dirent **namelist; + struct dirent **namelist = NULL; bool found = false; count = scandir(DT_FS_PATH, &namelist, NULL, alphasort);