From patchwork Wed Sep 5 15:05:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Veli-Pekka Peltola X-Patchwork-Id: 181889 X-Patchwork-Delegate: sr@denx.de 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 EB2382C008F for ; Thu, 6 Sep 2012 01:06:27 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C41312818F; Wed, 5 Sep 2012 17:06:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 UlrJWlKXVCx4; Wed, 5 Sep 2012 17:06:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA3E62817F; Wed, 5 Sep 2012 17:06:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CFE702817F for ; Wed, 5 Sep 2012 17:06:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 RhNNNrD4Z3eB for ; Wed, 5 Sep 2012 17:06:19 +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 darkblue.bluegiga.com (bluegiga.fi [194.100.31.45]) by theia.denx.de (Postfix) with ESMTP id 173D82817E for ; Wed, 5 Sep 2012 17:06:17 +0200 (CEST) Received: from bluegiga.com ([10.1.1.75]) by darkblue.bluegiga.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 5 Sep 2012 18:06:15 +0300 Received: by bluegiga.com (sSMTP sendmail emulation); Wed, 05 Sep 2012 18:05:59 +0300 From: Veli-Pekka Peltola To: u-boot@lists.denx.de Date: Wed, 5 Sep 2012 18:05:14 +0300 Message-Id: <1346857514-14742-1-git-send-email-veli-pekka.peltola@bluegiga.com> X-Mailer: git-send-email 1.7.9.5 X-OriginalArrivalTime: 05 Sep 2012 15:06:15.0160 (UTC) FILETIME=[FE8C7780:01CD8B77] Cc: kmpark@infradead.org Subject: [U-Boot] [PATCH v2] ubifs: Fix ubifsload when using ZLIB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Using ZLIB compression with UBIFS fails if last data node is not a size of UBIFS_BLOCK_SIZE (4096 bytes). Easiest way to test this is trying to read a file smaller than 4k: => ubifsload 41000000 /etc/fstab Loading file '/etc/fstab' to addr 0x41000000 with size 704 (0x000002c0)... UBIFS error (pid 0): read_block: bad data node (block 0, inode 2506) UBIFS error (pid 0): do_readpage: cannot read page 0 of inode 2506, error -22 Error reading file '/etc/fstab' /etc/fstab not found! exit not allowed from main input shell. => With this patch: => ubifsload 41000000 /etc/fstab Loading file '/etc/fstab' to addr 0x41000000 with size 704 (0x000002c0)... Done => Signed-off-by: Veli-Pekka Peltola Cc: kmpark@infradead.org Tested-by: Andreas Bießmann --- Changes for v2: use proper variable type fs/ubifs/ubifs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index c68802b..d241774 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -37,8 +37,7 @@ DECLARE_GLOBAL_DATA_PTR; static int gzip_decompress(const unsigned char *in, size_t in_len, unsigned char *out, size_t *out_len) { - unsigned long len = in_len; - return zunzip(out, *out_len, (unsigned char *)in, &len, 0, 0); + return zunzip(out, *out_len, (unsigned char *)in, (unsigned long *)out_len, 0, 0); } /* Fake description object for the "none" compressor */