From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-bw0-f49.google.com ([209.85.214.49]) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PHXKy-0005cm-GU for linux-mtd@lists.infradead.org; Sun, 14 Nov 2010 07:49:22 +0000 Received: by bwz5 with SMTP id 5so4471014bwz.36 for ; Sat, 13 Nov 2010 23:49:18 -0800 (PST) Subject: Re: [PATCH 06/10] mtd-utils: nandwrite: Use 64-bit offset From: Artem Bityutskiy To: Mike Frysinger In-Reply-To: References: <1288772847-8120-1-git-send-email-computersforpeace@gmail.com> <1288772847-8120-6-git-send-email-computersforpeace@gmail.com> <1289648919.2218.39.camel@localhost> Content-Type: text/plain; charset="UTF-8" Date: Sun, 14 Nov 2010 09:49:10 +0200 Message-ID: <1289720950.1978.0.camel@koala> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: David Woodhouse , Brian Norris , linux-mtd@lists.infradead.org, Jehan Bing Reply-To: dedekind1@gmail.com List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Sat, 2010-11-13 at 17:45 -0500, Mike Frysinger wrote: > On Sat, Nov 13, 2010 at 06:48, Artem Bityutskiy wrote: > > On Wed, 2010-11-03 at 01:27 -0700, Brian Norris wrote: > >> - mtdoffset = strtol(optarg, NULL, 0); > >> + mtdoffset = strtoll(optarg, NULL, 0); > > > > Ideally this should check for strtoll failures, but this just a side > > note. Not sure if this is the best way, but I'd do it like this: > > > > char *endp; > > > > mtdoffset = strtoul(optarg, &endp, 0); > > if (*endp != '\0' || endp == optarg) > > return errmsg("bad volume alignment: \"%s\"", optarg); > > > > or something like this. The check for negative mtdoffset could be there > > as well. > > or use simple_strtoll() from common.h as that includes error handling ... Oh, even better. -- Best Regards, Artem Bityutskiy (Битюцкий Артём)