Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp368754rdb; Fri, 5 Jan 2024 12:37:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgd+dN8N1oa84dpMx812D6or+/Ju/s24Dwe8u/e3W6cyJN6aP0MusbaLks5gupyKK8hyaA X-Received: by 2002:a05:600c:6011:b0:40d:8d05:4d31 with SMTP id az17-20020a05600c601100b0040d8d054d31mr21236wmb.30.1704487034709; Fri, 05 Jan 2024 12:37:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704487034; cv=none; d=google.com; s=arc-20160816; b=rOp2JEJjUtUAV/6rVuQeyTw+ujTCqMNJAB5uLNzj0KX60+8JX9pp1XE+XpLfxI2E7W O/N4dKzt39Cj4r2ZRPIa/SEtEisWijBFxOqFHgqO4fB6HezDSNzTrFMHFhXjv0YfVPrc zcEv078dBhryiHXA0Ukadwwvtp1FnR+Y5J9UUmBVTGTxRq92uGSbgo7r91LoE9Rohkbq fw9xGmr/dFVnBy6T/4AwdIHQICREVQQGS6aiamgcDu8azPHglSxXyK5a9UnITo5fx5NS pS+YmOWJnrtWieA01ppW4Oi9zv0rBeFPQ5grvZzwX4jzj5JCNhqkOXs8UW8fgLgDa+Qa dgyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=bk5Dr8X0YOCHd1Jl3i1ek4zNKLgAMly86kV1nZv04w8=; fh=T0ElDg7ZXl9G0iX6MtcvwxzEjvilBue4sbAVwm7h12A=; b=yg7DnESme6V0CY5w2ywYDPk5F0OL5aUjU8EXkalr1yv3kPwrRJnUDw1/cZyhhxJfNu 7vpo2qFwCZ9aM0MZmL7pui2sTQ3hWdyjWDOIW1UAa2NCesHPMicLJijPUPVRKOCWQfWK 9xN2VEHWaamIRZLlCVxhdrmRQZ5iF/VMo+Sku9t07d8JHtqrwklAdffZ8Ilc3iOXo6XH kogTlWf8QmFyXwA43BhW8lMYUB/MjYePz7GM24cy8QDH6RxB806E98an5oVogC+BUCGv 5tHmdTWsbE/joCJc+gbvXseMSW+ZAyrxpwktfgI4VCSsOLVS3R8Zfg5SFvwuAXpS72hF D+qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=JusJDyBO; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=lJrUv454; spf=pass (google.com: domain of linux-kernel+bounces-18329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18329-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z5-20020a170906240500b00a26a97f2653si859008eja.96.2024.01.05.12.37.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 12:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=JusJDyBO; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=lJrUv454; spf=pass (google.com: domain of linux-kernel+bounces-18329-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18329-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 788BE1F24372 for ; Fri, 5 Jan 2024 20:37:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8001E20327; Fri, 5 Jan 2024 20:37:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="JusJDyBO"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lJrUv454" X-Original-To: linux-kernel@vger.kernel.org Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40EA01DFDE for ; Fri, 5 Jan 2024 20:37:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 1D9FC5C01D5; Fri, 5 Jan 2024 15:37:02 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Fri, 05 Jan 2024 15:37:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1704487022; x=1704573422; bh=bk5Dr8X0YO CHd1Jl3i1ek4zNKLgAMly86kV1nZv04w8=; b=JusJDyBOqH5aYpg1JJ0cZU03Qy 8utzg8I/uIquFPhD9KB0o2hhXJ5mmxxBDb9gHFjlixisHcH4rVx/EUrQw91nNcj8 oCHfGyIxIupA+0nFVkUsqwWOAIUlX7yrVpD3Ktb2ssZ5C8W0aDBKEZi3vFT6fyzj XU+x71fF2SvAuj4/4gLBe/9qE7VBjlmZV7G+AkeddZ1o6CE7SgPQR+PShW74YZy4 rn3gpx3PsUZo+G6x4BMQjjXqPcBFteFQ60Mh4EifYB5EGeCKqPah0o3R15gJo+WF vg2TMbCE3/0+mfhKaJ1nhqNAIjkDAYOJc15tpAypclyVI0Wvst8Pp9ytz6dA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704487022; x=1704573422; bh=bk5Dr8X0YOCHd1Jl3i1ek4zNKLgA Mly86kV1nZv04w8=; b=lJrUv4548hvfuZxjAOK3VHoopmjb2+gPlkLQtF5nsc08 7a6hlKbXyFVPjU/BCjteIWBtETcKIuvICwRo8Gd0sijrFjWeHC8JKTG5vbsnoBFj v45r7Y6JRaf4Z7gorSufAQoOM/2eiikCsY4SVQcsoz6ZNHdevc8dPGfIBOds31m+ YxILU9dDYSoFGIU16D6/j/GR3XC32OW+rxHbGudtrejACXjRdnhnUE252YVXvgZi d20tPglqnUhAuZ/EgNNXPfqd7G4wAU0oIj2P7V5KIuOxKA/L13qB+uUCnO4LgED1 kU2idQDsU3OiPGHmXItapmJb9JDwDTyI93b8NyBXmQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdegledgudefhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeeuhfejgeehhfefgfffhfdvjefhueetjeegffeuhfdvffelfffgtddvvefh ledugfenucffohhmrghinhepihhnfhhrrgguvggrugdrohhrghenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 840EAB6008D; Fri, 5 Jan 2024 15:37:01 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1364-ga51d5fd3b7-fm-20231219.001-ga51d5fd3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20508695-b9e6-4aaa-9c78-84891c1a8f9a@app.fastmail.com> In-Reply-To: References: <20240103155702.4045835-1-arnd@kernel.org> Date: Fri, 05 Jan 2024 21:36:38 +0100 From: "Arnd Bergmann" To: "Keith Busch" , "Arnd Bergmann" Cc: "Christoph Hellwig" , "Sagi Grimberg" , "Chaitanya Kulkarni" , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, "Daniel Wagner" , "Hannes Reinecke" Subject: Re: [PATCH 1/2] nvmet: re-fix tracing strncpy() warning Content-Type: text/plain On Fri, Jan 5, 2024, at 21:24, Keith Busch wrote: > On Wed, Jan 03, 2024 at 04:56:55PM +0100, Arnd Bergmann wrote: >> @@ -53,8 +53,7 @@ static inline void __assign_req_name(char *name, struct nvmet_req *req) >> return; >> } >> >> - strncpy(name, req->ns->device_path, >> - min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path))); >> + strscpy_pad(name, req->ns->device_path, DISK_NAME_LEN); >> } > > I like this one, however Daniel has a different fix for this already > staged in nvme-6.8: > > > https://git.infradead.org/nvme.git/commitdiff/8f6c0eec5fad13785fd53a5b3b5f8b97b722a2a3 + snprintf(name, + min_t(size_t, DISK_NAME_LEN, strlen(req->ns->device_path) + 1), + "%s", req->ns->device_path); Don't we still need the zero-padding here to avoid leaking kernel data to userspace? Arnd