public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Campbell Suter <campbell@snapit.group>
Cc: u-boot@lists.denx.de,
	Joao Marcos Costa <joaomarcos.costa@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH] squashfs: Fix sqfsls errors when root is a ldir
Date: Wed, 15 Dec 2021 12:20:23 +0100	[thread overview]
Message-ID: <20211215122023.2d48d134@xps13> (raw)
In-Reply-To: <2c0316b0-8f40-550b-d1cf-a72e812d55a4@snapit.group>

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.
> 

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 <version>

Otherwise for this commit:
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>

> Signed-off-by: Campbell Suter <campbell@snapit.group>
> ---
> 
>   fs/squashfs/sqfs.c | 16 +++++++++++++---
>   1 file changed, 13 insertions(+), 3 deletions(-)
> 
> 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_stream *dirs, char **token_list,
>     	/* Initialize squashfs_dir_stream members */
>   	dirs->table += SQFS_DIR_HEADER_SIZE;
> -	dirs->size = get_unaligned_le16(&dir->file_size) - SQFS_DIR_HEADER_SIZE;
> +	if (le16_to_cpu(dirs->i_dir.inode_type) == SQFS_DIR_TYPE)
> +		dirs->size = get_unaligned_le16(&dir->file_size);
> +	else
> +		dirs->size = get_unaligned_le32(&ldir->file_size);
> +	dirs->size -= SQFS_DIR_HEADER_SIZE;
>   	dirs->entry_count = dirs->dir_header->count + 1;
>     	/* No path given -> root directory */
>   	if (!strcmp(token_list[0], "/")) {
>   		dirs->table = &dirs->dir_table[offset];
> -		memcpy(&dirs->i_dir, dir, sizeof(*dir));
> +		if (le16_to_cpu(dirs->i_dir.inode_type) == 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_stream *dirs, char **token_list,
>   		}
>     		dirs->table += SQFS_DIR_HEADER_SIZE;
> -		dirs->size = get_unaligned_le16(&dir->file_size);
> +		if (le16_to_cpu(dirs->i_dir.inode_type) == SQFS_DIR_TYPE)
> +			dirs->size = get_unaligned_le16(&dir->file_size);
> +		else
> +			dirs->size = get_unaligned_le32(&ldir->file_size);
>   		dirs->entry_count = dirs->dir_header->count + 1;
>   		dirs->size -= SQFS_DIR_HEADER_SIZE;
>   		free(dirs->entry);


Thanks,
Miquèl

  reply	other threads:[~2021-12-15 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-15  1:53 [PATCH] squashfs: Fix sqfsls errors when root is a ldir Campbell Suter
2021-12-15 11:20 ` Miquel Raynal [this message]
2022-01-28 23:36 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211215122023.2d48d134@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=campbell@snapit.group \
    --cc=joaomarcos.costa@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox