From patchwork Mon Nov 29 08:01:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 73385 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 E8820B70E3 for ; Mon, 29 Nov 2010 19:12:04 +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 1PMyhD-0004r5-3O; Mon, 29 Nov 2010 08:02:47 +0000 Received: from mms2.broadcom.com ([216.31.210.18]) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PMygt-0004mW-0z for linux-mtd@lists.infradead.org; Mon, 29 Nov 2010 08:02:28 +0000 Received: from [10.9.200.131] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Mon, 29 Nov 2010 00:02:26 -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; Mon, 29 Nov 2010 00:02:08 -0800 Received: from localhost.localdomain (ld-irv-0074 [10.12.160.50]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id E34DC74D03; Mon, 29 Nov 2010 00:02:07 -0800 (PST) From: "Brian Norris" To: linux-mtd@lists.infradead.org Subject: [PATCH 4/8] nanddump: change "unsigned" to "signed" Date: Mon, 29 Nov 2010 00:01:58 -0800 Message-ID: <1291017722-23985-4-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1291017722-23985-1-git-send-email-computersforpeace@gmail.com> References: <1291017722-23985-1-git-send-email-computersforpeace@gmail.com> MIME-Version: 1.0 X-WSS-ID: 60ED81985RK3601255-02-01 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20101129_030227_565695_71CF11A0 X-CRM114-Status: GOOD ( 13.50 ) 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 For consistency between nanddump and nandwrite and in order to provide better means for checking for negative inputs, the "offset" and "length" types in nanddump should be changed to signed integer types. This also solves a signed/unsigned comparison warning. Signed-off-by: Brian Norris --- nanddump.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nanddump.c b/nanddump.c index 14a8816..b0dd7dc 100644 --- a/nanddump.c +++ b/nanddump.c @@ -82,8 +82,8 @@ static bool pretty_print = false; // print nice static bool noecc = false; // don't error correct static bool noskipbad = false; // don't skip bad blocks static bool omitoob = false; // omit oob data -static unsigned long long start_addr; // start address -static unsigned long long length; // dump length +static long long start_addr; // start address +static long long length; // dump length static const char *mtddev; // mtd device name static const char *dumpfile; // dump file name static bool omitbad = false; @@ -136,7 +136,7 @@ static void process_options(int argc, char * const argv[]) omitbad = true; break; case 's': - start_addr = simple_strtoull(optarg, &error); + start_addr = simple_strtoll(optarg, &error); break; case 'f': if (!(dumpfile = strdup(optarg))) { @@ -145,7 +145,7 @@ static void process_options(int argc, char * const argv[]) } break; case 'l': - length = simple_strtoull(optarg, &error); + length = simple_strtoll(optarg, &error); break; case 'o': omitoob = true; @@ -273,8 +273,8 @@ nil: */ int main(int argc, char * const argv[]) { - unsigned long long ofs, end_addr = 0; - unsigned long long blockstart = 1; + long long ofs, end_addr = 0; + long long blockstart = 1; int ret, i, fd, ofd = 0, bs, badblock = 0; struct mtd_dev_info mtd; char pretty_buf[PRETTY_BUF_LEN];