Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3606653ioo; Wed, 25 May 2022 04:30:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw98mondy0NHJWdobYB8hJbC7Q4bf9T8oOJrPDJGeTWs4tsS5S3ZFYuuH7UenbT+qTYRUmY X-Received: by 2002:a17:902:eccd:b0:161:9e20:1a14 with SMTP id a13-20020a170902eccd00b001619e201a14mr31811358plh.43.1653478208226; Wed, 25 May 2022 04:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653478208; cv=none; d=google.com; s=arc-20160816; b=xYADq/TOiMmaTESAErD0FWk7yAZiROqbcflSmQhqmeRSIxJqorQ7w4TKTUeaJYAX4M 51DzSJc1d6I9u95qIUyP5MCLT1JBy0D5i/WAMcDsGKZaCkTEgoQ+Vfx4S4xRKjjlAO7u BQAGqFlT0TbhseIWhY35lYXCPuRTPMrBhMroaralLWelKJwYB1IoWzAhyPQo4yVuwuj6 ZuU1oWvyaVtDkinGFEyhqR+OnOPhLHrmPSpqD2rTRGdf8qr7Ku0VaE8KZdtYPvwdpBtN iIHRV/Z78+30/qILIM9/Y8PoLsstlTsmgSNyn0n7OT/bRxKA+Dqs+mFNp6NP/h6h9DNB i9Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=EUeQwmTBOWOfObmRhBnhBfMctz5HwYy150UhFHZvYt8=; b=W/VTgh6ZicDkSgxZ7/034VmEfsoyq/YCddSXGXtYVS39DAgPFk2oVVa1YBrArXi5Xe oBgsXviorHs3ZKB4HM7xqNI5/bCyUR2qhj8z4XH6jCYJOgi52KLYblyBKMRjCidw+yv/ xDVq7u27rr66suikEFk19KfAXXnh6HLyLTGjcADveov1R1QCkX2hhAJuuafPJruDgoos e69Pc4VKdEqXWgZi/M+4gsRK03X6PQjLAKSvTdGW1EbFzvC7zymOWgsNORC3PQL3/5Sw oztPY1qvTzE1CMpLVUPsJP4znqplNXPJnS3lkeAcZ/KsgmY04PgJdOd3X3IvapIgUNdV 9ZUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=UnHRh6h4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a170903234d00b0015f1388045csi19400604plh.156.2022.05.25.04.29.52; Wed, 25 May 2022 04:30:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=UnHRh6h4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239197AbiEXQUi (ORCPT + 99 others); Tue, 24 May 2022 12:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234684AbiEXQUd (ORCPT ); Tue, 24 May 2022 12:20:33 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B84A6351B; Tue, 24 May 2022 09:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=EUeQwmTBOWOfObmRhBnhBfMctz5HwYy150UhFHZvYt8=; b=UnHRh6h4UTReP5lgmM+TnvIKB7 AxleJR/jOfQ46N4JnR7MlT1t2lHCsViMy+iYZPl3TLicGBrfrztfFMg6E4oW8pXM9OTWL2Mcl+Qjg feoZ3DhIOyVD8BRxhKCtAH+cpBqSLVvOCWdf7qxKNaY4t4PDjRPtjmWkptwxCRZ9NVKMXm26S6BAk Y942KBggU/xKCx/gvw9XzgqxAAAyhT5VBXvBXqBRCd7AXTcxER9XPKqVGQtsLZ2NJbyJb9VW5YG0W ZyB4HtLHubX91W9y2oEjujYVl2Cqb/II4yFQzBQtWD24n7dBYVjjViU8sU3faKNTgWBpc2nqPOr9K U8ei3a+Q==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntXGo-008e2P-QD; Tue, 24 May 2022 16:20:30 +0000 Date: Tue, 24 May 2022 09:20:30 -0700 From: Luis Chamberlain To: Muchun Song Cc: LKML , linux-fsdevel , Matthew Wilcox , Kees Cook , Iurii Zaikin Subject: Re: [PATCH v2] sysctl: handle table->maxlen properly for proc_dobool Message-ID: References: <20220522052624.21493-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Luis Chamberlain X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 24, 2022 at 10:30:01AM +0800, Muchun Song wrote: > On Tue, May 24, 2022 at 1:27 AM Luis Chamberlain wrote: > > > > On Sun, May 22, 2022 at 01:26:24PM +0800, Muchun Song wrote: > > > Setting ->proc_handler to proc_dobool at the same time setting ->maxlen > > > to sizeof(int) is counter-intuitive, it is easy to make mistakes. For > > > robustness, fix it by reimplementing proc_dobool() properly. > > > > > > Signed-off-by: Muchun Song > > > Cc: Luis Chamberlain > > > Cc: Kees Cook > > > Cc: Iurii Zaikin > > > --- > > > > Thanks for your patch Muchun! > > > > Does this fix an actualy issue? Because the comit log suggest so. > > Thanks for taking a look. > > I think it is an improvement not a real bug fix. Then please adjust the commit log accordingly. > When I first use > proc_dobool in my driver, I assign sizeof(variable) to table->maxlen. > Then I found it was wrong, it should be sizeof(int) which was > counter-intuitive. So it is very easy to make mistakes. Should I add > those into the commit log? Yes that is useful information when doing patch review as well. Luis