mtd: fix false positive "Offset exceeds device limit" error
PATCH 1/1 mtd: fix false positive "Offset exceeds device limit" error
Since commit 09c3280754f8 (mtd, nand: Move common functions from cmd_nand.c to common place), NAND commands would not work at all on large devices.
=> nand read 80000000 10000 10000
NAND read: Offset exceeds device limit
=> nand erase 100000 100000
NAND erase: Offset exceeds device limit
The type of the "size" of "struct mtd_info" is uint64_t, while mtd_arg_off_size() and mtd_arg_off() treat chipsize as int type. The chipsize is wrapped around if the argument is given with 2GB or larger.
---
drivers/mtd/mtd_uboot.c | 5 +++-- include/linux/mtd/mtd.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/mtd/mtd_uboot.c +3 -2
@@ -43,7 +43,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size, }int mtd_arg_off (const char *arg,int *idx,loff_t *off,loff_t *size, -loff_t *maxsize,int devtype,int chipsize) +loff_t *maxsize,int devtype,uint64_t chipsize) {if (!str2off (arg, off))return get_part (arg, idx, off, size, maxsize, devtype);
@@ -59,7 +59,8 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size, }int mtd_arg_off_size (int argc,char *const argv[],int *idx,loff_t *off, -loff_t *size,loff_t *maxsize,int devtype,int chipsize) +loff_t *size,loff_t *maxsize,int devtype, +uint64_t chipsize) {int ret;
include/linux/mtd/mtd.h +3 -2
@@ -484,8 +484,9 @@ int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);int del_mtd_partitions (struct mtd_info *);int mtd_arg_off (const char *arg,int *idx,loff_t *off,loff_t *size, -loff_t *maxsize,int devtype,int chipsize); +loff_t *maxsize,int devtype,uint64_t chipsize);int mtd_arg_off_size (int argc,char *const argv[],int *idx,loff_t *off, -loff_t *size,loff_t *maxsize,int devtype,int chipsize); +loff_t *size,loff_t *maxsize,int devtype, +uint64_t chipsize);#endif #endif /* __MTD_MTD_H__ */
Signature · 1 line
1.9.1
PATCH 1/1 mtd: fix false positive "Offset exceeds device limit" error
Hey, quick review and apply please?
NAND commands are not working!
2015-07-01 21:35 GMT+09:00 Masahiro Yamada <[email protected]>:
Quoted 69 lines
Since commit
09c3280754f8(mtd, nand: Move common functions fromcmd_nand.cto common place), NAND commands would not work at all on large devices.=> nand read 80000000 10000 10000
NAND read: Offset exceeds device limit
=> nand erase 100000 100000NAND erase: Offset exceeds device limit
The type of the "size" of "struct
mtd_info" isuint64_t, whilemtd_arg_off_size()andmtd_arg_off()treat chipsize as int type. The chipsize is wrapped around if the argument is given with 2GB or larger.Signed-off-by Masahiro Yamada <[email protected]>---
drivers/mtd/mtd_uboot.c | 5 +++-- include/linux/mtd/mtd.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)drivers/mtd/mtd_uboot.c +3
-2@@ -43,7 +43,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size, }int mtd_arg_off (const char *arg,int *idx,loff_t *off,loff_t *size, -loff_t *maxsize,int devtype,int chipsize) +loff_t *maxsize,int devtype,uint64_t chipsize) {if (!str2off (arg, off))return get_part (arg, idx, off, size, maxsize, devtype);@@ -59,7 +59,8 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size, }int mtd_arg_off_size (int argc,char *const argv[],int *idx,loff_t *off, -loff_t *size,loff_t *maxsize,int devtype,int chipsize) +loff_t *size,loff_t *maxsize,int devtype, +uint64_t chipsize) {int ret;include/linux/mtd/mtd.h +3
-3@@ -484,8 +484,9 @@ int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);int del_mtd_partitions (struct mtd_info *);int mtd_arg_off (const char *arg,int *idx,loff_t *off,loff_t *size, -loff_t *maxsize,int devtype,int chipsize); +loff_t *maxsize,int devtype,uint64_t chipsize);int mtd_arg_off_size (int argc,char *const argv[],int *idx,loff_t *off, -loff_t *size,loff_t *maxsize,int devtype,int chipsize); +loff_t *size,loff_t *maxsize,int devtype, +uint64_t chipsize);#endif #endif /* __MTD_MTD_H__ */ --1.9.1
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/1 mtd: fix false positive "Offset exceeds device limit" error
Hello Masahiro,
Am 04.07.2015 um 19:07 schrieb Masahiro Yamada:
Quoted 30 lines
Hey, quick review and apply please?
NAND commands are not working!
2015-07-01 21:35 GMT+09:00 Masahiro Yamada <[email protected]>:
Quoted 22 lines
Since commit
09c3280754f8(mtd, nand: Move common functions fromcmd_nand.cto common place), NAND commands would not work at all on large devices.=> nand read 80000000 10000 10000
NAND read: Offset exceeds device limit
=> nand erase 100000 100000NAND erase: Offset exceeds device limit
The type of the "size" of "struct
mtd_info" isuint64_t, whilemtd_arg_off_size()andmtd_arg_off()treat chipsize as int type. The chipsize is wrapped around if the argument is given with 2GB or larger.Signed-off-by Masahiro Yamada <[email protected]>---
drivers/mtd/mtd_uboot.c | 5 +++-- include/linux/mtd/mtd.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
Thanks!
bye,
Heiko
Quoted 50 lines
Quoted 47 lines
drivers/mtd/mtd_uboot.c +3
-2@@ -43,7 +43,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size, }int mtd_arg_off (const char *arg,int *idx,loff_t *off,loff_t *size, -loff_t *maxsize,int devtype,int chipsize) +loff_t *maxsize,int devtype,uint64_t chipsize) {if (!str2off (arg, off))return get_part (arg, idx, off, size, maxsize, devtype);@@ -59,7 +59,8 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size, }int mtd_arg_off_size (int argc,char *const argv[],int *idx,loff_t *off, -loff_t *size,loff_t *maxsize,int devtype,int chipsize) +loff_t *size,loff_t *maxsize,int devtype, +uint64_t chipsize) {int ret;include/linux/mtd/mtd.h +3
-3@@ -484,8 +484,9 @@ int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);int del_mtd_partitions (struct mtd_info *);int mtd_arg_off (const char *arg,int *idx,loff_t *off,loff_t *size, -loff_t *maxsize,int devtype,int chipsize); +loff_t *maxsize,int devtype,uint64_t chipsize);int mtd_arg_off_size (int argc,char *const argv[],int *idx,loff_t *off, -loff_t *size,loff_t *maxsize,int devtype,int chipsize); +loff_t *size,loff_t *maxsize,int devtype, +uint64_t chipsize);#endif #endif /* __MTD_MTD_H__ */ --1.9.1
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 1/1 mtd: fix false positive "Offset exceeds device limit" error
In reply to Masahiro YamadaQuoted 16 lines · Masahiro Yamada
Since commit
09c3280754f8(mtd, nand: Move common functions fromcmd_nand.cto common place), NAND commands would not work at all on large devices.=> nand read 80000000 10000 10000
NAND read: Offset exceeds device limit
=> nand erase 100000 100000NAND erase: Offset exceeds device limit
The type of the "size" of "struct
mtd_info" isuint64_t, whilemtd_arg_off_size()andmtd_arg_off()treat chipsize as int type. The chipsize is wrapped around if the argument is given with 2GB or larger.
Quoted 6 lines
Signed-off-by Masahiro Yamada <[email protected]>---
drivers/mtd/mtd_uboot.c | 5 +++-- include/linux/mtd/mtd.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
I'm assuming this patch will be merged via whatever tree merged the breakage...
-Scott
PATCH 1/1 mtd: fix false positive "Offset exceeds device limit" error
Tom,
Could you directly apply this into your u-boot/master ?
Thanks,
Masahiro
2015-07-07 6:30 GMT+09:00 Scott Wood <[email protected]>:
Quoted 35 lines · Masahiro Yamada
Quoted 16 lines
Since commit
09c3280754f8(mtd, nand: Move common functions fromcmd_nand.cto common place), NAND commands would not work at all on large devices.=> nand read 80000000 10000 10000
NAND read: Offset exceeds device limit
=> nand erase 100000 100000NAND erase: Offset exceeds device limit
The type of the "size" of "struct
mtd_info" isuint64_t, whilemtd_arg_off_size()andmtd_arg_off()treat chipsize as int type. The chipsize is wrapped around if the argument is given with 2GB or larger.Quoted 6 lines
Signed-off-by Masahiro Yamada <[email protected]>---
drivers/mtd/mtd_uboot.c | 5 +++-- include/linux/mtd/mtd.h | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)Acked-by Scott Wood <[email protected]>I'm assuming this patch will be merged via whatever tree merged the breakage...
-Scott
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 1/1 mtd: fix false positive "Offset exceeds device limit" error
In reply to Masahiro YamadaQuoted 11 lines · Masahiro Yamada
Since commit
09c3280754f8(mtd, nand: Move common functions fromcmd_nand.cto common place), NAND commands would not work at all on large devices.=> nand read 80000000 10000 10000
NAND read: Offset exceeds device limit
=> nand erase 100000 100000NAND erase: Offset exceeds device limit
Quoted 8 lines
The type of the "size" of "struct
mtd_info" isuint64_t, whilemtd_arg_off_size()andmtd_arg_off()treat chipsize as int type. The chipsize is wrapped around if the argument is given with 2GB or larger.Acked-by Heiko Schocher <[email protected]>Acked-by Scott Wood <[email protected]>Signed-off-by Masahiro Yamada <[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: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150710/0fb59a3e/attachment.sig>