* [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw
@ 2024-02-01 18:18 Sean Anderson
2024-02-01 18:44 ` Michael Nazzareno Trimarchi
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sean Anderson @ 2024-02-01 18:18 UTC (permalink / raw)
To: u-boot, Mattijs Korpershoek; +Cc: qianfanguijin, Dan Carpenter, Sean Anderson
The return value of write_sparse_chunk_raw is unsigned, so the existing
check has no effect. Use IS_ERR_VALUE to detect error instead, which is
what write_sparse_chunk_raw does itself.
Fixes: 62649165cb0 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/u-boot/1b323ec3-59b0-490b-a2f0-fd961dafcf49@moroto.mountain/
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
---
lib/image-sparse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/image-sparse.c b/lib/image-sparse.c
index f8289064692..09225692e9b 100644
--- a/lib/image-sparse.c
+++ b/lib/image-sparse.c
@@ -211,7 +211,7 @@ int write_sparse_image(struct sparse_storage *info,
blks = write_sparse_chunk_raw(info, blk, blkcnt,
data, response);
- if (blks < 0)
+ if (IS_ERR_VALUE(blks))
return -1;
blk += blks;
--
2.35.1.1320.gc452695387.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw
2024-02-01 18:18 [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw Sean Anderson
@ 2024-02-01 18:44 ` Michael Nazzareno Trimarchi
2024-02-02 9:11 ` Mattijs Korpershoek
2024-02-06 12:49 ` Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Michael Nazzareno Trimarchi @ 2024-02-01 18:44 UTC (permalink / raw)
To: Sean Anderson; +Cc: u-boot, Mattijs Korpershoek, qianfanguijin, Dan Carpenter
On Thu, Feb 1, 2024 at 7:19 PM Sean Anderson <sean.anderson@seco.com> wrote:
>
> The return value of write_sparse_chunk_raw is unsigned, so the existing
> check has no effect. Use IS_ERR_VALUE to detect error instead, which is
> what write_sparse_chunk_raw does itself.
>
> Fixes: 62649165cb0 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Link: https://lore.kernel.org/u-boot/1b323ec3-59b0-490b-a2f0-fd961dafcf49@moroto.mountain/
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> ---
>
> lib/image-sparse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/image-sparse.c b/lib/image-sparse.c
> index f8289064692..09225692e9b 100644
> --- a/lib/image-sparse.c
> +++ b/lib/image-sparse.c
> @@ -211,7 +211,7 @@ int write_sparse_image(struct sparse_storage *info,
>
> blks = write_sparse_chunk_raw(info, blk, blkcnt,
> data, response);
> - if (blks < 0)
> + if (IS_ERR_VALUE(blks))
> return -1;
>
> blk += blks;
> --
> 2.35.1.1320.gc452695387.dirty
>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Michael
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
michael@amarulasolutions.com
__________________________________
Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw
2024-02-01 18:18 [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw Sean Anderson
2024-02-01 18:44 ` Michael Nazzareno Trimarchi
@ 2024-02-02 9:11 ` Mattijs Korpershoek
2024-02-06 12:49 ` Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2024-02-02 9:11 UTC (permalink / raw)
To: Sean Anderson, u-boot; +Cc: qianfanguijin, Dan Carpenter, Sean Anderson
Hi Sean,
Thank you for the patch.
On Thu, Feb 01, 2024 at 13:18, Sean Anderson <sean.anderson@seco.com> wrote:
> The return value of write_sparse_chunk_raw is unsigned, so the existing
> check has no effect. Use IS_ERR_VALUE to detect error instead, which is
> what write_sparse_chunk_raw does itself.
>
> Fixes: 62649165cb0 ("lib: sparse: Make CHUNK_TYPE_RAW buffer aligned")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Link: https://lore.kernel.org/u-boot/1b323ec3-59b0-490b-a2f0-fd961dafcf49@moroto.mountain/
> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> ---
>
> lib/image-sparse.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/image-sparse.c b/lib/image-sparse.c
> index f8289064692..09225692e9b 100644
> --- a/lib/image-sparse.c
> +++ b/lib/image-sparse.c
> @@ -211,7 +211,7 @@ int write_sparse_image(struct sparse_storage *info,
>
> blks = write_sparse_chunk_raw(info, blk, blkcnt,
> data, response);
> - if (blks < 0)
> + if (IS_ERR_VALUE(blks))
> return -1;
>
> blk += blks;
> --
> 2.35.1.1320.gc452695387.dirty
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw
2024-02-01 18:18 [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw Sean Anderson
2024-02-01 18:44 ` Michael Nazzareno Trimarchi
2024-02-02 9:11 ` Mattijs Korpershoek
@ 2024-02-06 12:49 ` Mattijs Korpershoek
2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2024-02-06 12:49 UTC (permalink / raw)
To: u-boot, Sean Anderson; +Cc: qianfanguijin, Dan Carpenter
Hi,
On Thu, 01 Feb 2024 13:18:51 -0500, Sean Anderson wrote:
> The return value of write_sparse_chunk_raw is unsigned, so the existing
> check has no effect. Use IS_ERR_VALUE to detect error instead, which is
> what write_sparse_chunk_raw does itself.
>
>
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)
[1/1] lib: sparse: Fix error checking for write_sparse_chunk_raw
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/09709a57d8b11fa021f54b9346c1dee1dbe282fb
--
Mattijs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-06 12:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01 18:18 [PATCH] lib: sparse: Fix error checking for write_sparse_chunk_raw Sean Anderson
2024-02-01 18:44 ` Michael Nazzareno Trimarchi
2024-02-02 9:11 ` Mattijs Korpershoek
2024-02-06 12:49 ` Mattijs Korpershoek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox