mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils
@ 2019-09-30  6:41 Ulrich Ölmann
  2019-09-30  6:41 ` [PATCH 2/3] state: backend_bucket_circular: fix double free() Ulrich Ölmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ulrich Ölmann @ 2019-09-30  6:41 UTC (permalink / raw)
  To: Barebox List

Comparing barebox' commit [1] with dt-utils' commit [2] it is obvious that
adjusting the return value has been forgotten in barebox - fix that.
(As the actual code that is changed is removed by the preprocesser when
compiling barebox this patch is only of cosmetic nature to keep both code bases
in sync).

[1] 9d6d91931afb ("state: Remove -EUCLEAN check from userspace tool")
[2] 791a2404116d ("state: Remove -EUCLEAN check from userspace tool")

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 common/state/backend_bucket_circular.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 47970b79f36a..612fa0cd8a11 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -179,9 +179,10 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ
 		dev_err(circ->dev, "Failed to read circular storage len %d, %d\n",
 			len, ret);
 		free(buf);
+		return ret;
 	}
 
-	return ret;
+	return 0;
 }
 
 static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *circ,
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] state: backend_bucket_circular: fix double free()
  2019-09-30  6:41 [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils Ulrich Ölmann
@ 2019-09-30  6:41 ` Ulrich Ölmann
  2019-09-30  6:41 ` [PATCH 3/3] common: state: fix backward compatibility Ulrich Ölmann
  2019-09-30 18:41 ` [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Ulrich Ölmann @ 2019-09-30  6:41 UTC (permalink / raw)
  To: Barebox List

This ports the following dt-utils commit (as the actual code that is changed is
removed by the preprocesser when compiling barebox this patch is only of
cosmetic nature to keep both code bases in sync):

| commit 634317cc91202304c1477a6d738d7c7691b80419
| Author: Kim Christensen <kch@skov.dk>
| Date:   Wed Sep 18 16:48:23 2019 +0200
|
|     state: backend_bucket_circular: fix double free()
|
|     The function state_mtd_peb_read() is only a user of buf and not its owner,
|     hence it may not deallocate it.
|
|     Signed-off-by: Kim Christensen <kch@skov.dk>
|     Reviewed-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
|     Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
|     Signed-off-by: Roland Hieber <rhi@pengutronix.de>

Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 common/state/backend_bucket_circular.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c
index 612fa0cd8a11..735510e0d36b 100644
--- a/common/state/backend_bucket_circular.c
+++ b/common/state/backend_bucket_circular.c
@@ -178,7 +178,6 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ
 	if (ret < 0) {
 		dev_err(circ->dev, "Failed to read circular storage len %d, %d\n",
 			len, ret);
-		free(buf);
 		return ret;
 	}
 
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] common: state: fix backward compatibility
  2019-09-30  6:41 [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils Ulrich Ölmann
  2019-09-30  6:41 ` [PATCH 2/3] state: backend_bucket_circular: fix double free() Ulrich Ölmann
@ 2019-09-30  6:41 ` Ulrich Ölmann
  2019-09-30 18:41 ` [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Ulrich Ölmann @ 2019-09-30  6:41 UTC (permalink / raw)
  To: Barebox List

This reverts [1] as it annihilated its counterpart of commit [2].

[1] 5033b4f58f71 ("common: state: harmonize code with dt-utils")
[2] 480cde1b2283 ("state: keep backward compatibility")

Fixes: 5033b4f58f71 ("common: state: harmonize code with dt-utils")
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
 common/state/backend_bucket_direct.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c
index 0dbd334db821..4522f0170f3d 100644
--- a/common/state/backend_bucket_direct.c
+++ b/common/state/backend_bucket_direct.c
@@ -115,9 +115,6 @@ static int state_backend_bucket_direct_write(struct state_backend_storage_bucket
 	int ret;
 	struct state_backend_storage_bucket_direct_meta meta;
 
-	if (len > direct->max_size - sizeof(meta))
-		return -E2BIG;
-
 	if (lseek(direct->fd, direct->offset, SEEK_SET) != direct->offset) {
 		dev_err(direct->dev, "Failed to seek file, %d\n", -errno);
 		return -errno;
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils
  2019-09-30  6:41 [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils Ulrich Ölmann
  2019-09-30  6:41 ` [PATCH 2/3] state: backend_bucket_circular: fix double free() Ulrich Ölmann
  2019-09-30  6:41 ` [PATCH 3/3] common: state: fix backward compatibility Ulrich Ölmann
@ 2019-09-30 18:41 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2019-09-30 18:41 UTC (permalink / raw)
  To: Ulrich Ölmann; +Cc: Barebox List

On Mon, Sep 30, 2019 at 08:41:35AM +0200, Ulrich Ölmann wrote:
> Comparing barebox' commit [1] with dt-utils' commit [2] it is obvious that
> adjusting the return value has been forgotten in barebox - fix that.
> (As the actual code that is changed is removed by the preprocesser when
> compiling barebox this patch is only of cosmetic nature to keep both code bases
> in sync).
> 
> [1] 9d6d91931afb ("state: Remove -EUCLEAN check from userspace tool")
> [2] 791a2404116d ("state: Remove -EUCLEAN check from userspace tool")
> 
> Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
> ---
>  common/state/backend_bucket_circular.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-30 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30  6:41 [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils Ulrich Ölmann
2019-09-30  6:41 ` [PATCH 2/3] state: backend_bucket_circular: fix double free() Ulrich Ölmann
2019-09-30  6:41 ` [PATCH 3/3] common: state: fix backward compatibility Ulrich Ölmann
2019-09-30 18:41 ` [PATCH 1/3] state: backend_bucket_circular: harmonize code with dt-utils Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox