Received: by mail.netbsd.org (Postfix, from userid 605) id D2A1884DA0; Sat, 9 Jun 2018 15:40:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 0249484D89 for ; Sat, 9 Jun 2018 15:40:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id sz4ppBKzEt5p for ; Sat, 9 Jun 2018 15:40:05 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 8E0B484D36 for ; Sat, 9 Jun 2018 15:40:05 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 87571FBEC; Sat, 9 Jun 2018 15:40:05 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Sat, 9 Jun 2018 15:40:05 +0000 From: "Martin Husemann" Subject: CVS commit: [netbsd-8] src/external/bsd/top/dist/machine To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20180609154005.87571FBEC@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: source-changes.NetBSD.org Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Martin Husemann" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: martin Date: Sat Jun 9 15:40:05 UTC 2018 Modified Files: src/external/bsd/top/dist/machine [netbsd-8]: m_netbsd.c Log Message: Pull up following revision(s) (requested by kamil in ticket #872): external/bsd/top/dist/machine/m_netbsd.c: revision 1.20 Fix read of unitialized array elements in top(1) The cp_old array is allocated with malloc(3) and its pointer is passed to= percentages64(). In this function there happens a calculation of total_change, which value= depends on the value inside the unitialized cp_old[] array. WARNING: MemorySanitizer: use-of-uninitialized-value /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6 /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:478:65 SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6 in percentages64 Exiting Fix this issue by changling malloc(3) with calloc(3). Detected with Memory Sanitizer during the integration of sanitizers with the NetBSD basesystem. Reported by To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.19.6.1 src/external/bsd/top/dist/machine/m_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.