All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Brian Norris" <computersforpeace@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Mike Frysinger <vapier.adi@gmail.com>,
	Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH v3 5/8] nanddump: check for negative inputs
Date: Tue, 30 Nov 2010 23:12:30 -0800	[thread overview]
Message-ID: <1291187550-17545-1-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1291184303-4596-1-git-send-email-computersforpeace@gmail.com>

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>
---
 nanddump.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

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");
-- 
1.7.0.4

  reply	other threads:[~2010-12-01  7:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29  8:01 [PATCH 1/8] nanddump/nandwrite: use "simple_" str functions Brian Norris
2010-11-29  8:01 ` [PATCH 2/8] mtd-utils: common.h: Add MAX() macro, fix MIN() Brian Norris
2010-11-29  8:01 ` [PATCH 3/8] nanddump: Refactor pretty print code into an sprintf() Brian Norris
2010-11-29  8:01 ` [PATCH 4/8] nanddump: change "unsigned" to "signed" Brian Norris
2010-11-29  8:01 ` [PATCH 5/8] nanddump: check for negative inputs Brian Norris
2010-12-01  6:18   ` [PATCH v2 " Brian Norris
2010-12-01  7:12     ` Brian Norris [this message]
2010-11-29  8:02 ` [PATCH 6/8] nanddump: choose correct "printf" format-specifier Brian Norris
2010-11-29  8:02 ` [PATCH 7/8] nandwrite: add check for negative blockalign Brian Norris
2010-11-29  8:05   ` Mike Frysinger
2010-12-01  6:11     ` Brian Norris
2010-12-01  6:19   ` [PATCH v2 " Brian Norris
2010-11-29  8:02 ` [PATCH 8/8] nandwrite: use common.h "errmsg_die" Brian Norris
2010-12-01  6:20   ` [PATCH v2 " Brian Norris
2010-12-02  3:27 ` [PATCH 1/8] nanddump/nandwrite: use "simple_" str functions Artem Bityutskiy

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=1291187550-17545-1-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=dedekind1@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=vapier.adi@gmail.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.