[PATCH 1/2] nanddump: verify that start address is page aligned

Baruch Siach baruch at tkos.co.il
Tue Oct 12 04:23:54 EDT 2010


Make nanddump consistent with nandwrite, which does not accept non page aligned
start addresses. Thus, non page aligned dumps are useless.

Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
 nanddump.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/nanddump.c b/nanddump.c
index 0fdf736..d6d1352 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -377,6 +377,12 @@ int main(int argc, char * const argv[])
 	}
 
 	/* Initialize start/end addresses and block size */
+	if (start_addr & (meminfo.writesize - 1)) {
+		fprintf(stderr, "The start address is not page-aligned !\n"
+				"The pagesize of this NAND Flash is 0x%x.\n",
+				meminfo.writesize);
+		goto closeall;
+	}
 	if (length)
 		end_addr = start_addr + length;
 	if (!length || end_addr > meminfo.size)
-- 
1.7.1




More information about the linux-mtd mailing list