diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2024-08-26 11:46:20 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-10-08 08:14:30 +0200 |
commit | 11c30d73d3927373a114e9ed274f627a124d9ad7 (patch) | |
tree | ddf96e337f866a5a2c143d3448e6244e3bb77403 /nand-utils | |
parent | 13ec33609213c1dbd75852a09560a707a7f19a5c (diff) |
nand-utils: nanddump: Use a specific variable for the buffer size
The read buffer size happen to be as big as the bs variable, but this is
going to change. When accessing the buffer size, use a specific variable
instead.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'nand-utils')
-rw-r--r-- | nand-utils/nanddump.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nand-utils/nanddump.c b/nand-utils/nanddump.c index 47539f5..346af1e 100644 --- a/nand-utils/nanddump.c +++ b/nand-utils/nanddump.c @@ -332,7 +332,7 @@ static int ofd_write(int ofd, const void *buf, size_t nbyte) */ int main(int argc, char * const argv[]) { - long long ofs, end_addr = 0; + long long ofs, end_addr = 0, readbuf_sz; long long blockstart = 1; int i, fd, ofd = 0, bs, badblock = 0; struct mtd_dev_info mtd; @@ -362,8 +362,9 @@ int main(int argc, char * const argv[]) return errmsg("mtd_get_dev_info failed"); /* Allocate buffers */ + readbuf_sz = mtd.min_io_size; oobbuf = xmalloc(mtd.oob_size); - readbuf = xmalloc(mtd.min_io_size); + readbuf = xmalloc(readbuf_sz); if (noecc) { if (ioctl(fd, MTDFILEMODE, MTD_FILE_MODE_RAW) != 0) { @@ -462,7 +463,7 @@ int main(int argc, char * const argv[]) end_addr = mtd.size; continue; } - memset(readbuf, 0xff, bs); + memset(readbuf, 0xff, readbuf_sz); } else { /* Read page data and exit on failure */ if (mtd_read(&mtd, fd, ofs / mtd.eb_size, ofs % mtd.eb_size, readbuf, bs)) { |