From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4CD6C433EF for ; Wed, 15 Dec 2021 11:20:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 27A1382054; Wed, 15 Dec 2021 12:20:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 645F380FF0; Wed, 15 Dec 2021 12:20:29 +0100 (CET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5EFF282982 for ; Wed, 15 Dec 2021 12:20:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bootlin.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=miquel.raynal@bootlin.com Received: (Authenticated sender: miquel.raynal@bootlin.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 6FA7720004; Wed, 15 Dec 2021 11:20:24 +0000 (UTC) Date: Wed, 15 Dec 2021 12:20:23 +0100 From: Miquel Raynal To: Campbell Suter Cc: u-boot@lists.denx.de, Joao Marcos Costa , Thomas Petazzoni Subject: Re: [PATCH] squashfs: Fix sqfsls errors when root is a ldir Message-ID: <20211215122023.2d48d134@xps13> In-Reply-To: <2c0316b0-8f40-550b-d1cf-a72e812d55a4@snapit.group> References: <2c0316b0-8f40-550b-d1cf-a72e812d55a4@snapit.group> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Campbell, campbell@snapit.group wrote on Wed, 15 Dec 2021 14:53:43 +1300: > Previously, if root had more than 256 files or otherwise needed to be an > ldir, sqfsls would emit the error 'Inode not found.' which was caused by > code in sqfs_search_dir assuming it was a regular directory inode. >=20 It would be good to group your commits into series, generated automatically with git-format-patch. Also when you send different version of patches, you need to generate them with a different version in the subject prefix with the option: -v Otherwise for this commit: Reviewed-by: Miquel Raynal > Signed-off-by: Campbell Suter > --- >=20 > fs/squashfs/sqfs.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) >=20 > diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c > index e2d91c654c..4d7bf76fa3 100644 > --- a/fs/squashfs/sqfs.c > +++ b/fs/squashfs/sqfs.c > @@ -482,13 +482,20 @@ static int sqfs_search_dir(struct squashfs_dir_stre= am *dirs, char **token_list, > /* Initialize squashfs_dir_stream members */ > dirs->table +=3D SQFS_DIR_HEADER_SIZE; > - dirs->size =3D get_unaligned_le16(&dir->file_size) - SQFS_DIR_HEADER_SI= ZE; > + if (le16_to_cpu(dirs->i_dir.inode_type) =3D=3D SQFS_DIR_TYPE) > + dirs->size =3D get_unaligned_le16(&dir->file_size); > + else > + dirs->size =3D get_unaligned_le32(&ldir->file_size); > + dirs->size -=3D SQFS_DIR_HEADER_SIZE; > dirs->entry_count =3D dirs->dir_header->count + 1; > /* No path given -> root directory */ > if (!strcmp(token_list[0], "/")) { > dirs->table =3D &dirs->dir_table[offset]; > - memcpy(&dirs->i_dir, dir, sizeof(*dir)); > + if (le16_to_cpu(dirs->i_dir.inode_type) =3D=3D SQFS_DIR_TYPE) > + memcpy(&dirs->i_dir, dir, sizeof(*dir)); > + else > + memcpy(&dirs->i_ldir, ldir, sizeof(*ldir)); > return 0; > } > @@ -608,7 +615,10 @@ static int sqfs_search_dir(struct squashfs_dir_str= eam *dirs, char **token_list, > } > dirs->table +=3D SQFS_DIR_HEADER_SIZE; > - dirs->size =3D get_unaligned_le16(&dir->file_size); > + if (le16_to_cpu(dirs->i_dir.inode_type) =3D=3D SQFS_DIR_TYPE) > + dirs->size =3D get_unaligned_le16(&dir->file_size); > + else > + dirs->size =3D get_unaligned_le32(&ldir->file_size); > dirs->entry_count =3D dirs->dir_header->count + 1; > dirs->size -=3D SQFS_DIR_HEADER_SIZE; > free(dirs->entry); Thanks, Miqu=C3=A8l