Skip to contentSkip to conversation

state: backend_bucket_circular: harmonize code with dt-utils

PATCH Applied Ulrich Ölmann 2 participants 4 messages Sep 30, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 state: backend_bucket_circular: harmonize code with dt-utils

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")

---
 common/state/backend_bucket_circular.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
common/state/backend_bucket_circular.c +2 -1
index 47970b79f36a..612fa0cd8a11 100644
@@ -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,
Signature · 7 lines
2.23.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/3 state: backend_bucket_circular: fix double free()

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 <[email protected]>
| 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 <[email protected]>
|     Reviewed-by: Ulrich Ölmann <[email protected]>
|     Reviewed-by: Uwe Kleine-König <[email protected]>
|     Signed-off-by: Roland Hieber <[email protected]>
---
 common/state/backend_bucket_circular.c | 1 -
 1 file changed, 1 deletion(-)
common/state/backend_bucket_circular.c +0 -1
index 612fa0cd8a11..735510e0d36b 100644
@@ -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;
 	}
 
Signature · 7 lines
2.23.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/3 common: state: fix backward compatibility

In reply to Ulrich Ölmann

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")
---
 common/state/backend_bucket_direct.c | 3 ---
 1 file changed, 3 deletions(-)
common/state/backend_bucket_direct.c +0 -3
index 0dbd334db821..4522f0170f3d 100644
@@ -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;
Signature · 7 lines
2.23.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#3 lore raw
In reply to Ulrich Ölmann
Quoted 6 lines · Ulrich Ölmann

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

Quoted 7 lines

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

---
 common/state/backend_bucket_circular.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

Signature · 9 lines
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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox