From patchwork Wed Dec 1 07:12:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 73733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from canuck.infradead.org (canuck.infradead.org [134.117.69.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 22890B6ED0 for ; Wed, 1 Dec 2010 18:20:40 +1100 (EST) Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PNgse-0000iT-Dk; Wed, 01 Dec 2010 07:13:32 +0000 Received: from mms2.broadcom.com ([216.31.210.18]) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PNgsb-0000iB-9X for linux-mtd@lists.infradead.org; Wed, 01 Dec 2010 07:13:29 +0000 Received: from [10.9.200.131] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Tue, 30 Nov 2010 23:13:30 -0800 X-Server-Uuid: D3C04415-6FA8-4F2C-93C1-920E106A2031 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB01.corp.ad.broadcom.com (10.9.200.131) with Microsoft SMTP Server id 8.2.247.2; Tue, 30 Nov 2010 23:13:10 -0800 Received: from localhost.localdomain (ld-irv-0074 [10.12.160.50]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 93D5A74D1E; Tue, 30 Nov 2010 23:13:06 -0800 (PST) From: "Brian Norris" To: linux-mtd@lists.infradead.org Subject: [PATCH v3 5/8] nanddump: check for negative inputs Date: Tue, 30 Nov 2010 23:12:30 -0800 Message-ID: <1291187550-17545-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.0.4 References: <1291184303-4596-1-git-send-email-computersforpeace@gmail.com> In-Reply-To: <1291184303-4596-1-git-send-email-computersforpeace@gmail.com> MIME-Version: 1.0 X-WSS-ID: 60EB2A105RK5416811-01-01 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20101201_021329_560231_0275D431 X-CRM114-Status: GOOD ( 12.51 ) X-Spam-Score: 1.2 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is freemail (computersforpeace[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 1.2 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL Cc: Brian Norris , David Woodhouse , Mike Frysinger , Artem Bityutskiy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- 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");