diff options
author | Brian Norris <computersforpeace@gmail.com> | 2010-11-30 23:12:30 -0800 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-12-02 05:25:50 +0200 |
commit | beb602b6a3d1cc7b2edaab517d94abebe5f4a445 (patch) | |
tree | 46826d053360b91321271cfcb92b5529ade7afb3 | |
parent | 59b4ceaa65902ff2dcf13d12fb4ef97ea3ad8cec (diff) |
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 <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
-rw-r--r-- | nanddump.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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"); |