diff mbox

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

Message ID 50168b5d486e28a9d7f7685537710e05242c4f12.1286871735.git.baruch@tkos.co.il
State New, archived
Headers show

Commit Message

Baruch Siach Oct. 12, 2010, 8:23 a.m. UTC
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@tkos.co.il>
---
 nanddump.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Artem Bityutskiy Oct. 16, 2010, 7:08 p.m. UTC | #1
On Tue, 2010-10-12 at 10:23 +0200, Baruch Siach wrote:
> 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@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;
> +	}

I'm fine with this change in general, but theoretically we may have a
user who relies on this. Could you please instead print a warning but
preserve the old behavior. Then in after the next release we can make
remove the warning and turn it into an error, just like this patch do.
This will potentially be user-friendly.

Add a new record to the feature-removal-schedule.txt file. I'll then
turn the warning into an error at some point.

Thanks!
diff mbox

Patch

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)