mtd: mtdpart: use uint64_t instead of int for cur_off
PATCH 1/1 mtd: mtdpart: use uint64_t instead of int for cur_off
The types of "offset" and "size" of "struct mtd_partition" are uint64_t, while mtd_parse_partitions() uses int to work with these values. When the offset reaches 2GB, it is interpreted as a negative value, which leads to error messages like
mtd: partition "<partition name>" is out of reach -- disabled
eg. when using the "ubi part" command.
Fix this by using uint64_t for cur_off and cur_sz.
--- drivers/mtd/mtdpart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/mtdpart.c +1 -1
@@ -207,7 +207,7 @@ int mtd_parse_partitions(struct mtd_info *parent, const char **_mtdparts, {struct mtd_partition partition = {}, *parts;const char *mtdparts = *_mtdparts; -int cur_off =0 , cur_sz =0 ; +uint64_t cur_off =0 , cur_sz =0 ;int nparts =0 ;int ret, idx;u64 sz;
Signature · 1 line
2.20.1
PATCH 1/1 mtd: mtdpart: use uint64_t instead of int for cur_off
Hello Martin,
Am 13.07.2020 um 14:40 schrieb Martin Kaistra:
Quoted 9 lines
The types of "offset" and "size" of "struct
mtd_partition" areuint64_t, whilemtd_parse_partitions()uses int to work with these values. When the offset reaches 2GB, it is interpreted as a negative value, which leads to error messages likemtd: partition "<partition name>" is out of reach -- disabled
eg. when using the "ubi part" command.
Quoted 7 lines
Fix this by using
uint64_tforcur_offandcur_sz.Signed-off-by Martin Kaistra <[email protected]>Reviewed-by Kurt Kanzenbach <[email protected]>--- drivers/mtd/mtdpart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de
PATCH 1/1 mtd: mtdpart: use uint64_t instead of int for cur_off
In reply to Martin KaistraQuoted 7 lines · Martin Kaistra
The types of "offset" and "size" of "struct
mtd_partition" areuint64_t, whilemtd_parse_partitions()uses int to work with these values. When the offset reaches 2GB, it is interpreted as a negative value, which leads to error messages likemtd: partition "<partition name>" is out of reach -- disabled
Quoted 7 lines
eg. when using the "ubi part" command.
Fix this by using
uint64_tforcur_offandcur_sz.Signed-off-by Martin Kaistra <[email protected]>Reviewed-by Kurt Kanzenbach <[email protected]>Reviewed-by Heiko Schocher <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200717/7636120c/attachment.sig>