From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11614 Path: news.gmane.org!.POSTED!not-for-mail From: Vicente Bergas Newsgroups: gmane.linux.lib.musl.general Subject: calloc question about clearing allocated memory Date: Mon, 26 Jun 2017 23:30:53 +0200 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1498567051 15214 195.159.176.226 (27 Jun 2017 12:37:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 27 Jun 2017 12:37:31 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-11627-gllmg-musl=m.gmane.org@lists.openwall.com Tue Jun 27 14:37:27 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1dPpkD-0003go-EZ for gllmg-musl@m.gmane.org; Tue, 27 Jun 2017 14:37:25 +0200 Original-Received: (qmail 7604 invoked by uid 550); 27 Jun 2017 12:37:28 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 23558 invoked from network); 26 Jun 2017 21:31:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=M2r3sb3taN/Up2h21x807gT9Xmj04cbAfGSsQBEd/co=; b=ZPwHGRh/+chvY9Io+qzrC/pjob+Jc3lDEYMmMkz5zfrG2K68snWhJ04otkVifOgts5 KN34t/xHKesYovtU2SdCf8HPdpiYqFMVutDc7UEVYTum4DfvwUcW4L96UnyaH8/wdaDA NX88jtIe19GJqDRcCxphpL7j+W7lljsshwuw5M5gW2p67JbFkWyP3NL35VIwj3VR4OJF uojBvY6dflOSDV52le7sxTb/FrI3GJYXEee7MRfZBWiC3UkwpuobBneb7CsY4KpUmqK6 F5TtfdYDCVNH/FHc21JGSPHdjisaf24LTAVEtpsKuQgeMvucpmTWxs1hDSMSJkAPXpHI 59og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=M2r3sb3taN/Up2h21x807gT9Xmj04cbAfGSsQBEd/co=; b=HbqmHrNjRzoMdOWtpyNQcCgZOKJCYcmVU154i5XdY6cx9vX818gWccJLVREhc4LUyx /LvNwp6ERn2coj1godglXLtqK//zcFdQeVJZW92nEh022Hf015IKFDdJXyVSDXaI8MmD 4dbsEqoMlmk4eBRE2y0s2aHW+SMFDEfkghLz5n5RTco+MY3bb7Ij7+le55MSYyltb1mx 5CvkLdiHZcFvmLcs0Mqt918M4l/5DRulu9UqcxTNJuHtgGItAHNFmx5mOPCqbTZXvrhp 5ew7V8EwLl+elZe7eqGaf6imdmflDr6ByD7r6jn+j/qGRKxUG3hr9oJi0ir4bi/O3S+U iO3A== X-Gm-Message-State: AKS2vOwOPqr3H6iNmqPnvpPLa8fRUrzPI5wuzlSC2frVxBmW43FcOyLL WF4i+6hfmyIt7USh3u/z7k3DKMIa+9By X-Received: by 10.107.62.132 with SMTP id l126mr3366764ioa.162.1498512654066; Mon, 26 Jun 2017 14:30:54 -0700 (PDT) Xref: news.gmane.org gmane.linux.lib.musl.general:11614 Archived-At: Hello, when compiling a program against the musl libc and running it under valgrind, then it reports lots of uninitialized value errors. I have tracked them down to only two sources: http://git.musl-libc.org/cgit/musl/tree/src/string/strlen.c?id=3De6def544#n= 15 http://git.musl-libc.org/cgit/musl/tree/src/malloc/malloc.c?id=3De6def544#n= 375 The first one about strlen is clearly an optimization everybody would like to have, but the second one in __malloc0 is not that obvious. Please, could that be explained: why is *z read just before being cleared? In fact it is counter-intuitive and looks like an overhead. In case there is a reason for it, it would be nice to put an explanatory comment there. Otherwise, that extra read could be removed to make valgrind happy. Regards, Vicen=C3=A7. P.S.: Please, CC me as I am not subscribed to the list.