U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: u-boot@lists.denx.de
Subject: Re: [PATCH] btrfs: fix some error checking for btrfs_decompress()
Date: Thu, 3 Aug 2023 18:36:46 +0800	[thread overview]
Message-ID: <0a706809-6634-0874-e2c1-7056df3409a3@gmx.com> (raw)
In-Reply-To: <57f2b396-3db8-42ef-bdcc-a7aafd290694@moroto.mountain>



On 2023/8/3 18:29, Dan Carpenter wrote:
> The btrfs_decompress() function mostly (u32)-1 on error but it can
> also return -EPERM or other kernel error codes from zstd_decompress().
> The "ret" variable is an int, so we could just check for negatives.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu
> ---
>   fs/btrfs/inode.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 38e285bf94b0..4691612eda33 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -390,7 +390,7 @@ int btrfs_read_extent_inline(struct btrfs_path *path,
>   			   csize);
>   	ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi),
>   			       cbuf, csize, dbuf, dsize);
> -	if (ret == (u32)-1) {
> +	if (ret < 0) {
>   		ret = -EIO;
>   		goto out;
>   	}
> @@ -500,7 +500,7 @@ int btrfs_read_extent_reg(struct btrfs_path *path,
>
>   	ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi), cbuf,
>   			       csize, dbuf, dsize);
> -	if (ret == (u32)-1) {
> +	if (ret < 0) {
>   		ret = -EIO;
>   		goto out;
>   	}

  reply	other threads:[~2023-08-03 10:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03 10:29 [PATCH] btrfs: fix some error checking for btrfs_decompress() Dan Carpenter
2023-08-03 10:36 ` Qu Wenruo [this message]
2023-08-09  1:40 ` 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=0a706809-6634-0874-e2c1-7056df3409a3@gmx.com \
    --to=quwenruo.btrfs@gmx.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