Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp391661rdh; Thu, 23 Nov 2023 06:47:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJDVw8dX+f3I2dAhnM13bLPr3fyuo3Fw6RSlqt1SJwNytyMwf+ANfWnQrCuLWFkbrTqCua X-Received: by 2002:a92:3610:0:b0:35b:f756:dafc with SMTP id d16-20020a923610000000b0035bf756dafcmr5108755ila.1.1700750874223; Thu, 23 Nov 2023 06:47:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700750874; cv=none; d=google.com; s=arc-20160816; b=ewNzeHB3BDfCxLkFSdg3FaSSA/EX+wZTJLPwRCjg0HHSIu1mF//VJjSx/7O1FEKyLP 1TSQl6un2Ubb/Qu/FkIq0cBWWCzA0v4ngChKj9NURecbFVqFIW4R2WXtbcdnYOAPfj3v 6OEFSLFy7D+s62IeCRLXKTlLg1tNJ3qBklixvcOBivMD7Gj0npChRs5XQap+LjGRX3or wntAxirUbEUmEKzJBfribEmpzwAJ5mcTlRpUD/SP+8z6gFU3nJCbQS60FWemRYNM7iAl GXQOoF7Yc0XTFLElUS/3zXrivh86n8UUQ0fCDluyFXLhb6UILcBAorx28xQpHVDpAwNv /eFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VDPZeER5+waLJOtLwkyRIoPVFaSQQ+HYww2bR0yYVa4=; fh=K7JTbn/6Fr0rUOW8D40pbqlaV128T0M3u3cYivjljvU=; b=iw6A+71dF+lHsW8gfACQ74NyF3CrMoj6aPCDJ0FxJ6E2tuCSMMzK5yqdtCDR9Nfhx7 bIbPaZpKL7PcX/J6X6Lj25tbNAiVf1Zf+uLTHD7J9rmZrgUG3TqqDAEF5frBMKYDYGhL dP590TYWW+PvQnaiBnkkRyAE9vldlbw+v4mRG7L4kIU/Nw3HmNbnRS7W7KdqjtWoGwcv wIVqlCHLnPJAjs9jD261fUwNObfmn2Wea7DKlEesqUu52ByIMHhMTQ1pDS4RztfR2BCM fR9usc/7wOkrQbhb6cApL9cghHAJ+aPUWUqIaCM1Jowu0PkurcNIx1aI90riTTnrns/0 4Usg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hZo0f+CL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id p24-20020a056a000a1800b006cb90e7f47csi1363166pfh.199.2023.11.23.06.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 06:47:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hZo0f+CL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 80A9E8083DBD; Thu, 23 Nov 2023 06:47:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345914AbjKWOrg (ORCPT + 99 others); Thu, 23 Nov 2023 09:47:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345905AbjKWOre (ORCPT ); Thu, 23 Nov 2023 09:47:34 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82BBD4F for ; Thu, 23 Nov 2023 06:47:39 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BAE1C433C7; Thu, 23 Nov 2023 14:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700750859; bh=+th0nIoDm1aaTnqJ4eM6ZXTyefMOYaMLSlSeSUCjtjc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hZo0f+CLMFYCcBTjYTUawrekLzgsPKFVVK7dGUuLcztUIWJoYKIV31J/zWOdbqLLj +6xJAATodTiRJJy+Ll3TQBa8GaOyS+88QHHEM+Umo985t4LWSqucNd9buqN5s+F0qS d6EFak9zGW7Q2FpFVu1ZI80EbL8iKJYTv1vYpmKAEpFT14Az+2xWh8HY6nbEAkKy77 lfolfJ+gtBOxKChZ03O3eZKtLzn+aQ4Gm3i92Ohi4b8MYhUe1ZkeKd5RaiEc1ZaB72 uo8luPBhZPDY/Gb/gR5fz1DN4o/m0GHjHEIBoqOnHyNDD+nxnDwcKhJ2QSJnaKXGR+ 2So+TMpaoW6sw== Date: Thu, 23 Nov 2023 14:47:35 +0000 From: Lee Jones To: Andy Shevchenko Cc: Linus Walleij , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, Pavel Machek Subject: Re: [PATCH v1 2/4] leds: trigger: gpio: Convert to use kstrtox() Message-ID: <20231123144735.GB1354538@google.com> References: <20231103195310.948327-1-andriy.shevchenko@linux.intel.com> <20231103195310.948327-2-andriy.shevchenko@linux.intel.com> <20231123110538.GA1243364@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Thu, 23 Nov 2023 06:47:51 -0800 (PST) On Thu, 23 Nov 2023, Andy Shevchenko wrote: > On Thu, Nov 23, 2023 at 11:05:38AM +0000, Lee Jones wrote: > > On Fri, 03 Nov 2023, Andy Shevchenko wrote: > > ... > > > > - ret = sscanf(buf, "%u", &desired_brightness); > > "%u" (see man sscanf() for the details) > > ... > > > > + ret = kstrtou8(buf, 10, &desired_brightness); > > > > Where does 10 come from? > > See above. Hmmm ... I see that this is generally accepted. Although is looks like a recipe for bugs to me. It's a shame we don't have something that can take a variable, derives its type, then calculates the maximum length if converted to a string. Anyway, I'm probably babbling now ... -- Lee Jones [李琼斯]