From: Miquel Raynal <miquel.raynal@bootlin.com>
To: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Cc: Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Pratyush Yadav <pratyush@kernel.org>,
Michael Walle <michael@walle.cc>, <linux-mtd@lists.infradead.org>,
Julien Su <juliensu@mxic.com.tw>,
Alvin Zhou <alvinzhou@mxic.com.tw>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Miquel Raynal <miquel.raynal@bootlin.com>
Subject: [PATCH mtd-utils 01/10] nand-utils: nanddump: Use a specific variable for the buffer size
Date: Mon, 26 Aug 2024 11:46:20 +0200 [thread overview]
Message-ID: <20240826094629.19065-2-miquel.raynal@bootlin.com> (raw)
In-Reply-To: <20240826094629.19065-1-miquel.raynal@bootlin.com>
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>
---
nand-utils/nanddump.c | 7 ++++---
1 file 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)) {
--
2.43.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-08-26 9:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 9:46 [PATCH mtd-utils 00/10] New options for hardening continuous read support Miquel Raynal
2024-08-26 9:46 ` Miquel Raynal [this message]
2024-08-26 9:46 ` [PATCH mtd-utils 02/10] nand-utils: nanddump: Explicitely use the page size when relevant Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 03/10] nand-utils: nanddump: Add support for testing continuous reads Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 04/10] mtd-tests: nandbiterrs: Store the chunks size in an intermediate variable Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 05/10] mtd-tests: nandbiterrs: Add support for testing continuous reads Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 06/10] mtd-tests: flash_speed: Drop an apparently useless block Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 07/10] mtd-tests: flash_speed: Clarify the number of pages in each set while measuring Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 08/10] mtd-tests: flash_speed: Generalize read_eraseblock_by_2pages() Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 09/10] mtd-tests: flash_speed: Drop read_eraseblock_by_page() Miquel Raynal
2024-08-26 9:46 ` [PATCH mtd-utils 10/10] mtd-tests: flash_speed: Benchmark continuous reads Miquel Raynal
2024-10-08 7:00 ` [PATCH mtd-utils 00/10] New options for hardening continuous read support David Oberhollenzer
2024-10-08 8:35 ` Miquel Raynal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240826094629.19065-2-miquel.raynal@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=alvinzhou@mxic.com.tw \
--cc=david.oberhollenzer@sigma-star.at \
--cc=juliensu@mxic.com.tw \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=thomas.petazzoni@bootlin.com \
--cc=tudor.ambarus@linaro.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.