Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752625AbbGAGgB (ORCPT ); Wed, 1 Jul 2015 02:36:01 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:38546 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750869AbbGAGfy convert rfc822-to-8bit (ORCPT ); Wed, 1 Jul 2015 02:35:54 -0400 MIME-Version: 1.0 In-Reply-To: <559387DF.9050606@intel.com> References: <55935B19.5080103@intel.com> <55936976.7090001@intel.com> <559387DF.9050606@intel.com> Date: Wed, 1 Jul 2015 08:35:53 +0200 Message-ID: Subject: Re: [PATCH V2] lib/bitmap.c: fix some parsing issues and code style From: Frans Klaver To: Pan Xinhui Cc: "linux-kernel@vger.kernel.org" , Yury Norov , Andrew Morton , Rasmus Villemoes , tj@kernel.org, Peter Zijlstra , sudeep.holla@arm.com, mina86@mina86.com, "mnipxh@163.com" , Alexey Klimov , "yanmin_zhang@linux.intel.com" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1882 Lines: 52 On Wed, Jul 1, 2015 at 8:25 AM, Pan Xinhui wrote: > hello, Frans > thanks for your reply :) > > On 2015年07月01日 14:17, Frans Klaver wrote: >> >> On Wed, Jul 1, 2015 at 6:15 AM, Pan Xinhui wrote: >>> >>> >>> In __bitmap_parselist we can accept whitespaces on head or tail >>> during every parsing procedure. >>> If input has valid ranges, there is no reason to reject the user. >>> >>> fixes are: >>> 1) if input ends with ',', bit 0 might be set unexpectedly. >>> now we check if any digit is available after every loop. >>> 2) if input has '0-', bit 0 might be set unexpectedly, >>> now we return -EINVAL as this kind of input is definitely wrong. >>> 3) minor code style fix in __bitmap_parse. >>> and avoid in-loop incrementation of ndigits. >> >> >> Why not three patches, so it becomes easier to see which is which? >> > your advice sounds good, I will have a try. and welcome for review. :) > thanks. > >> >>> commit 2528a8b also add some check, but it's still not enough. >>> it only correct the result in fix 1 above. >> >> >> I believe the convention is to have at least 12 characters of the >> sha1, with the title behind it: 2528a8b8f457 (__bitmap_parselist: fix >> bug in empty string handling). Using only seven characters still risks >> collisions. >> > sorry for my lack knowledge of comment rules. thanks for pointing out my > mistakes. No problem. These kinds of things can be caught if you use scripts/checkpatch.pl on your patches before sending, by the way. You should probably read Documentation/SubmittingPatches if you haven't already done so. Frans -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/