From: Brian Norris Date: Wed, 1 Dec 2010 07:12:30 +0000 (-0800) Subject: nanddump: check for negative inputs X-Git-Tag: v1.4.2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=beb602b6a3d1cc7b2edaab517d94abebe5f4a445;p=mtd-utils.git nanddump: check for negative inputs Includes error messages for negative device offsets and negative lengths, telling the user what the offending option and value were. Previous patch left out the "negative" in the error message. Signed-off-by: Brian Norris Signed-off-by: Artem Bityutskiy --- diff --git a/nanddump.c b/nanddump.c index b0dd7dc..6a6f904 100644 --- a/nanddump.c +++ b/nanddump.c @@ -173,6 +173,13 @@ static void process_options(int argc, char * const argv[]) } } + if (start_addr < 0) + errmsg_die("Can't specify negative offset with option -s: %lld", + start_addr); + + if (length < 0) + errmsg_die("Can't specify negative length with option -l: %lld", length); + if (quiet && pretty_print) { fprintf(stderr, "The quiet and pretty print options are mutually-\n" "exclusive. Choose one or the other.\n");