From patchwork Wed Sep 2 23:36:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siarhei Siamashka X-Patchwork-Id: 513694 X-Patchwork-Delegate: hdegoede@redhat.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 6703514029E for ; Thu, 3 Sep 2015 09:36:54 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=sfpbtmzQ; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 437204B719; Thu, 3 Sep 2015 01:36:52 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fkCHtiFUENH0; Thu, 3 Sep 2015 01:36:51 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C27F4B6FA; Thu, 3 Sep 2015 01:36:51 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5CBAF4B6FA for ; Thu, 3 Sep 2015 01:36:48 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rYJ6Hpt-Gi_G for ; Thu, 3 Sep 2015 01:36:48 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by theia.denx.de (Postfix) with ESMTPS id 18E384B6F5 for ; Thu, 3 Sep 2015 01:36:45 +0200 (CEST) Received: by lanb10 with SMTP id b10so17485306lan.3 for ; Wed, 02 Sep 2015 16:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FQ5QTkBTMGHRRjBQ2vgsQT+9qDPMzlFDzpEumdYZRbg=; b=sfpbtmzQjPpLGIGeRWyG9FZ7YKCqeMFNgRXWqBE6w6w7D6vO+uTPi0Usm0J79fKjzd +TDP5yc6AvKxQDcix2my/45EUkSzWstPqr8wJBeIEiuy00rjWArdZ1QrcKiEoyLOVssu +Csht6Y9M2ti0FhwB5x5gne7t/oMQsC0EgBinfaGexTX1pM9EACGeGRix1NtW6kaYELW c6UK2KEDI0BB0VCWSztc2NXaGtNnvw/lQQzEq1SKJk6A0E36TE0BnX9nOmFh0drAF4kQ wslzlzKfjxFykt+B+o0xPu84OCoLbDN69iPqMpBN/0Qe0CH2Czr44NOQGvL50470OMnw 6mnw== X-Received: by 10.112.234.165 with SMTP id uf5mr18060436lbc.91.1441237004828; Wed, 02 Sep 2015 16:36:44 -0700 (PDT) Received: from localhost.localdomain (85-76-73-171-nat.elisa-mobile.fi. [85.76.73.171]) by smtp.gmail.com with ESMTPSA id i1sm3038946lah.10.2015.09.02.16.36.42 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Sep 2015 16:36:44 -0700 (PDT) From: Siarhei Siamashka To: u-boot@lists.denx.de Date: Thu, 3 Sep 2015 02:36:39 +0300 Message-Id: <1441236999-31780-1-git-send-email-siarhei.siamashka@gmail.com> X-Mailer: git-send-email 2.4.6 Cc: Ian Campbell , Bernhard Nortmann Subject: [U-Boot] [PATCH] sunxi: Ensure that 'mksunxiboot' tool produces deterministic output X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Currently some uninitialized padding bytes are written to the output file, as can be confirmed with valgrind: $ valgrind tools/mksunxiboot spl/u-boot-spl.bin spl/sunxi-spl.bin ==5581== Syscall param write(buf) points to uninitialised byte(s) ==5581== at 0x4F0F940: __write_nocancel (in /lib64/libc-2.20.so) ==5581== by 0x400839: main (in /tmp/u-boot/tools/mksunxiboot) ==5581== Address 0xffeff5d3c is on thread 1's stack ==5581== in frame #1, created by main (???) This patch fixes the problem by clearing the whole structure instead of just a portion of it. Signed-off-by: Siarhei Siamashka --- tools/mksunxiboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mksunxiboot.c b/tools/mksunxiboot.c index 3361251..676d392 100644 --- a/tools/mksunxiboot.c +++ b/tools/mksunxiboot.c @@ -99,7 +99,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } - memset(img.pad, 0, BLOCK_SIZE); + memset(&img, 0, sizeof(img)); /* get input file size */ file_size = lseek(fd_in, 0, SEEK_END);