Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2140250pxf; Sat, 27 Mar 2021 03:42:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8NCX7b4NBWLhnXSGF7v31717vxQkUQOGLIPuaJO9wZtJ+SlPE8mRJugrfgS/kvOZdr+Xk X-Received: by 2002:a17:906:bfcc:: with SMTP id us12mr20134724ejb.266.1616841749856; Sat, 27 Mar 2021 03:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616841749; cv=none; d=google.com; s=arc-20160816; b=LEWw920wfRqb076C+oQrwljPGI1UnV1sB86z8eBQgFcGK1OIsep615GIij14zPUyvV d6aUW0KY+JcGk+cW8N+hswuVtmC9Q8jx3VRH+0ihLbiwW8LOrzo6lF4gC3JtQf96D/Ti XlVK9mYxiQT6Kf9o0k/68FcnVqV3AWxnK1y5q40+KhDqf6EmdNMkfU6+yuwL04+t8k6a QiLAWI17Lyx/nEL2Kuh8z+Qq4Pki3P8/3U0gbk8BEqPZGv7E+eEXLn/LhaSJQKF+rvUo AW3ola2oCONFAtwOv+74bnLP0Ahvnui8hKFvjq7pEUvcjoVTjF6q2WLMjcxGSGZ4OQQU 0s+A== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=rlCpEeZ8jDS1lgCxwL+8UG+0KQYJ9NVQzqCdEKtSqNE=; b=yaCEUkF+ke8gd1qlel/A4+EyBNUZtTRkQsoWFb1nW6d7WHOEvuCIKArfG7RJhgo+lD fVaG3QVm2+4ZDLEsdQswHCfejNzwc8OfOerFSu8bw1EfT4KPs3AKYD2ZTjN/M2/mj90a n3GfTrPbpzDSRx4GexlJfWcLziglVVnp8Qvqq72CA1LsOoBnh9KK8RxzbBAUuJh4IdGi GAHpFo8E0YptI3jU1zCVXkuwVnJjM5H+4QGf2oEbkWr/0hbcNGk8vsLbq8tK1muO2TFQ KbeIyGPTQQoklHpsHu9c4fC7FvrYtHmBuQwFWACV2qUCrDfj7WmyZ1ia/cFTh96hkZRc LqGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kroah.com header.s=fm3 header.b=dizU7vMg; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=uPe3K8Tr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w18si8681627ejy.196.2021.03.27.03.42.06; Sat, 27 Mar 2021 03:42:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kroah.com header.s=fm3 header.b=dizU7vMg; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=uPe3K8Tr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230288AbhC0Kll (ORCPT + 99 others); Sat, 27 Mar 2021 06:41:41 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:38471 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbhC0Kll (ORCPT ); Sat, 27 Mar 2021 06:41:41 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 67B005803A8; Sat, 27 Mar 2021 06:41:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sat, 27 Mar 2021 06:41:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kroah.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=rlCpEeZ8jDS1lgCxwL+8UG+0KQY J9NVQzqCdEKtSqNE=; b=dizU7vMg85Rxgf+LtmzxnwuBG80VnViEsFM36i6pC4S /PBUIKiarmO0uc25Gf/cj3KTh3E9nKvBnHjoOM9IZznUYFkSVqfqb6zWGM0AjEbE Fuu+avQT0VznZSoZwbkauEPiMDMmyamzpA2sibkIRV36iLveeBozBEdoPPwRcbgN IT3/LMF6xEttTvfLnHzNa+s+YrBGjx7fxmxaLUAYQsRtNjntGYq1blAAz/AvggaD 5F3AAYwFforg634aSUNY/UL8Q3XD3WT+y0P1SJeCs8qzDluloAneJVhcxCgpKzKL jPQ3vo9GRwriEMmQ7DU/tOXxWNFRoGK52vmxJn/XOmw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=rlCpEe Z8jDS1lgCxwL+8UG+0KQYJ9NVQzqCdEKtSqNE=; b=uPe3K8Trvd5dbx5sZi42Ft TPYBa4QgM7tLCVkWkjBvuGb/q1slTJlZQ1LjVJBF/LEKU2Pgbou1AK8y2SkTQGV3 NVeNi4yMpJiJls8tZ5HHmDBfXHk8FxcDc2+A9xOcxow/Wzz1ie5LDF8Ix33pDLu9 HG/zrMxUqlAU+J+mUBK83EAO+FcfMCMzV4m9RIR3cavmc0g7Q1SIHTV9OFleAtN7 2w4UhTi0kPEaNFeuETJtKZed94S5slWa113MZe4PhWa/5d2CGDQK1NA48+d84qB9 /lfK4oKZFrt6Qxl+hKfEMA7BvDrhdjoaAcMLG9azYQ63XBn+qMTjkvaOXEStc6ww == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudehgedgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefirhgvghcu mffjuceoghhrvghgsehkrhhorghhrdgtohhmqeenucggtffrrghtthgvrhhnpeevueehje fgfffgiedvudekvdektdelleelgefhleejieeugeegveeuuddukedvteenucfkphepkeef rdekiedrjeegrdeigeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) by mail.messagingengine.com (Postfix) with ESMTPA id C04E7240057; Sat, 27 Mar 2021 06:41:38 -0400 (EDT) Date: Sat, 27 Mar 2021 11:41:36 +0100 From: Greg KH To: Peter Zijlstra Cc: Rasmus Villemoes , mingo@kernel.org, mgorman@suse.de, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, joshdon@google.com, valentin.schneider@arm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 6/9] debugfs: Implement debugfs_create_str() Message-ID: References: <20210326103352.603456266@infradead.org> <20210326103935.183934395@infradead.org> <70594935-18e6-0791-52f9-0448adf37155@rasmusvillemoes.dk> <20210326142230.GJ4746@worktop.programming.kicks-ass.net> <20210326151912.GL4746@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210326151912.GL4746@worktop.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 04:19:12PM +0100, Peter Zijlstra wrote: > On Fri, Mar 26, 2021 at 03:58:37PM +0100, Rasmus Villemoes wrote: > > > kmalloc(len + 2, ...); > > > > No, because nul-terminating the stuff you pass to > > simple_read_from_buffer is pointless cargo-culting. Yeah, read_file_bool > > does it, but that's just bogus. > > Urgh, feel yuck to not have it zero terminated, but if you feel strongly > about it I suppose I can make it go away. > > > > len = strscpy(copy, str, len); > > > if (len < 0) > > > return len; > > > > To what end? The only way that could possibly return -EFOO is if the > > nul-terminator in str vanished between the strlen() and here, and in > > that case you have bigger problems. > > There are strings in the kernel which we rewrite in most ugly ways, > task_struct::comm comes to mind. Best be paranoid. > > > > Copy-pasta from debugfs_*_bool(). This thing seems to export everything > > > and I figured I'd go along with that. > > > > I thought the convention was not to export anything until the kernel > > itself had a (modular) user. > > That's generally how I feel too. But this really isn't my subsystem so I > more or less try to mimmick what I see done there. I'll take some time next week and go through and remove any exports in debugfs that are not actually needed for exports as it's been a while since I last looked... But that should not affect this change, it's fine to me as-is. thanks, greg k-h