Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753358AbdHULvc (ORCPT ); Mon, 21 Aug 2017 07:51:32 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:34907 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750967AbdHULva (ORCPT ); Mon, 21 Aug 2017 07:51:30 -0400 Date: Mon, 21 Aug 2017 14:50:37 +0300 From: Dan Carpenter To: Ilya Matveychikov Cc: Baoquan He , Andrew Morton , Ingo Molnar , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, ben.hutchings@codethink.co.uk Subject: Re: [PATCH] lib/cmdline.c: add to the get_options() documentation Message-ID: <20170821115036.mg2v7wfl565kksht@mwanda> References: <20170821094602.baz6tv2v23sem3kw@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 925 Lines: 24 On Mon, Aug 21, 2017 at 02:42:52PM +0400, Ilya Matveychikov wrote: > > > On Aug 21, 2017, at 1:46 PM, Dan Carpenter wrote: > > > > I wasn't sure how get_options() worked, so I looked at examples. And by > > sheer chance the first example I picked the only example which uses it > > incorrectly... I've added some comments that hopefully help. > > > > See also comments on my patch from Ben Hutchings: > https://patchwork.kernel.org/patch/9811617/ Ugh... The implementation of get_options() looks gnarly, yes. That affects the part of my comment which says: + * string. It stores the number of numbers as the first element in the + * array. If we are going to keep the current behavior then we should specify that ints[0] can be higher than "nints - 1". But I feel like the current behavior is wrong and that get_range() should never return more than n. regards, dan carpenter