Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oBzNk-0006ue-Fl for mharc-grub-devel@gnu.org; Thu, 14 Jul 2022 09:59:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBzNh-0006o1-MH for grub-devel@gnu.org; Thu, 14 Jul 2022 09:59:53 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:47212) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBzNe-0006zs-M0 for grub-devel@gnu.org; Thu, 14 Jul 2022 09:59:53 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26EDckbN008483 for ; Thu, 14 Jul 2022 13:59:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2021-07-09; bh=lOdRspfWc3XmcGh+W40yuEDgwJas2RFkM3DCmnKztQc=; b=Y7m5LwAZbCfU7AVsAnfsik/kjH+09QM6gRtWw501NMbxyDRHBSP/2VEMHqGocJwoh2XM nnlpBFbKoxSCASI57IETKlFVXQwzta0KVPBa7IQ9Fm7Xf5meuLAZG2pGKRJlo7R4tELn 8QNHHqaxF8BW9wjX2787KSsA/dr3VcRIarUUbhfAupZK8PeMNE2u0e83S/hJXy1opL/Q Nllg2hoyn++FMC+ObMX8eT0KSc8XTDVU7OdwiUfYgPe/DV9apD5Jyv3lGK5sTRZendoK SMZoJD+WQEZS3EoqVmn/Z1zkxcstd3J1n2ybVg9/LW5D6UWCNZHkfswZomzJLN2JVK6h Fw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3h71scdafb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 14 Jul 2022 13:59:43 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.16.1.2/8.16.1.2) with SMTP id 26EDpQpQ036699 for ; Thu, 14 Jul 2022 13:59:42 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3h704693av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 14 Jul 2022 13:59:42 +0000 Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 26EDxfn4021468 for ; Thu, 14 Jul 2022 13:59:41 GMT Received: from bur-virt-x6-2-100.us.oracle.com (bur-virt-x6-2-100.us.oracle.com [10.153.92.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com with ESMTP id 3h704693ad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 14 Jul 2022 13:59:41 +0000 From: Ross Philipson To: grub-devel@gnu.org Cc: daniel.kiper@oracle.com, ross.philipson@oracle.com, alec.r.brown@oracle.com, darren.kenny@oracle.com, jag.raman@oracle.com Subject: [PATCH] Initialize local relocator subchunk struct to all zeros Date: Thu, 14 Jul 2022 09:41:28 -0400 Message-Id: <1657806088-4908-1-git-send-email-ross.philipson@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-GUID: SnYs_uNOZOELBM0CPJl7eVDb1PqQJfZw X-Proofpoint-ORIG-GUID: SnYs_uNOZOELBM0CPJl7eVDb1PqQJfZw Received-SPF: pass client-ip=205.220.177.32; envelope-from=ross.philipson@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jul 2022 13:59:54 -0000 The way the code is written the tofree variable would never be passed to the free_subchunk() function uninitialized. Coverity cannot determine this and flags the situation as "Using uninitialized value...". The fix is just to initialize the local struct. Fixes: CID 314016 Signed-off-by: Ross Philipson --- grub-core/lib/relocator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c index 68ef128..bfcc70d 100644 --- a/grub-core/lib/relocator.c +++ b/grub-core/lib/relocator.c @@ -989,7 +989,7 @@ malloc_in_range (struct grub_relocator *rel, if (j != 0 && events[j - 1].pos != events[j].pos) { grub_addr_t alloc_start, alloc_end; - struct grub_relocator_subchunk tofree; + struct grub_relocator_subchunk tofree = {0}; struct grub_relocator_subchunk *curschu = &tofree; if (!oom) curschu = &res->subchunks[cural]; -- 1.8.3.1