aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMartin Kaistra <martin.kaistra@linutronix.de>2020-07-13 14:40:02 +0200
committerTom Rini <trini@konsulko.com>2020-07-17 10:47:19 -0400
commit892d4617357db355bf847ca37dd76cf946727ec2 (patch)
tree28e243f736ef16c7ccbd3019be79725110c79a54 /drivers
parentb72bbf575b02f1845e1088d1c98390748fc51944 (diff)
downloadu-boot-892d4617357db355bf847ca37dd76cf946727ec2.zip
u-boot-892d4617357db355bf847ca37dd76cf946727ec2.tar.gz
u-boot-892d4617357db355bf847ca37dd76cf946727ec2.tar.bz2
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. Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/mtdpart.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d1f6029..d064ac3 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -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;