Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1592385rdb; Tue, 20 Feb 2024 00:25:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXDLjPvzJrdSu9Vq36ePVk3Gs8cVZjXnQ479FG6gUreiMUihs2X1STxCbgkvE2Imnx1POOFngNNXIV97Ok3wqmSCbc4G0RBM7A771pBBA== X-Google-Smtp-Source: AGHT+IEZNFKqHtP6XbslFaSVEu8jt4U5CWsNvu/wb8jeAIPqNy+ldDrG91DgpPv+3HWLQc5I3mpm X-Received: by 2002:a05:622a:4c9:b0:42c:6efe:bd18 with SMTP id q9-20020a05622a04c900b0042c6efebd18mr18611969qtx.66.1708417506005; Tue, 20 Feb 2024 00:25:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708417505; cv=pass; d=google.com; s=arc-20160816; b=so2BACNBxkRZFtUGtbMD/BlJbyudZh8BTX+vykvEOjNg5sncFgl7kj33ypmem4R+zi jQnhKCxbQTR+DT8e+RS3KWkbqPcPBVrR1UbbPwNUz06e+vkBYCprejemH0mbfsPdEmtZ uJXTPPu0RWwar2+JAnk8mVLDGo2p9wDptgrxTaH3b12hZak5uBJWNKM5GJ9lZdL2e7Vs ClC59EjxNPPssVrqKE2zqGmgeDHVgUctvRUTz1ZiY9IzFj/jM50qh6v0HASguIPJpOIM wupwx/UHHwF+J4nvgfkxbJkJdyuFdqRnZtiHR1bl800M8CX4UAx5MCih2dBXnF6Yr+6p at1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=D1b7GjSWRVVNKNxSF/RQ5kMh0x7tHRRDH5IiV6jlucg=; fh=BLBsHX0bEEMeUBGxfNi0FsdtRK/Foqdl4/JMXIvWyEg=; b=lH8k0cjmr8zGYQ40NK0wySmaBlYrBTLZYhfi27MmTgurr+B6JDR8c6itfA03ZHmIQm g3htSBXt07Xy8hB0PKGpi+aBGu10M+mIJLD6wxZdiyy1QxSfZ4SnJrK/wNUZHW64llLG 9/4kiX77IaSZBLk4kssYFV6jBes0f+VjQxozwoyl7rkkogtmafLwnI2OfrdgAa4vkNOl BSiW2+fu5VdDaARoR4gwhy3/c9QEghjoBuv82BAJ3r3lagCwTM+0n/AolrEkUl6GKYdf LtWKnCw0z5bsyZEx7TBIUTiMs4Jxf6+1/W5RUuKvGUh0w6e1yfw6A7AyTSTFqx67+CvP 4+3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VQ+u7iKR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72542-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d10-20020ac8668a000000b0042c59340e59si7317484qtp.598.2024.02.20.00.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 00:25:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72542-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VQ+u7iKR; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-72542-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72542-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A54971C2263C for ; Tue, 20 Feb 2024 08:25:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D9825CDCA; Tue, 20 Feb 2024 08:24:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VQ+u7iKR" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 914205C5F9; Tue, 20 Feb 2024 08:24:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417490; cv=none; b=IWo/hhQW05lDT8mZDj7qC7Y8rnJSHdORNIu2DvteHeylp47cs8oHwbKS4+1r8rKufa3RO7sO4HwZafa9LjfQM1C+GJqoRGW3qfR9l7k40QtsM838CkkGfOfRg7JIJgo0udfv15PaW6AEINVvLgUNg9EFuNz3M0f9nKe0n1m9Tvw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417490; c=relaxed/simple; bh=o7IhKXDzwH+CSSEaHA40a69Pk3oXdDwj9C4S5J5Ncmc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FNz8V73Sv8+IdQ3F9k8A3781fHVzZNgfmaMuATa289gfGi/XhulcMtvJBv6FdtKiFh6l5f8kfoLGQgjqZnXqIvknBhZp2NXSmonAvWWrTAWVP8ZWU7qdVcrf3Cl2err/NHX5CSsEoAkKb9pXGLPKg298xI4fHdDbMeLr2ZfiesI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VQ+u7iKR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD151C43399; Tue, 20 Feb 2024 08:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708417490; bh=o7IhKXDzwH+CSSEaHA40a69Pk3oXdDwj9C4S5J5Ncmc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VQ+u7iKRqijmTFoTEmptfvIprnx9ryUDSI3kw8AifYGxDlkufqMcNPB9PC/iCD1i8 DFun1qkoL3q6Co5UCEFCNDr32LL+IVWIq7RV7TP7aqW/Aqf5xfiUnOZmHZ0wnpVi4L 70oCtuZ764e6jUThAzjQ3oP8slxFQShh8VuL8oUML8cl3V3ZQlHbknEI4UXSaPEUS9 T4mhSGD/QtZy+nHiqiRpga8LdHo0jjNYWutCdwXXtXmq62roWyFRcT+hqnbA8jeyNT f1d5XoHHhRIYgUwoP04wBO4uvhIjgTswbsbhgLPftMYq7Fu5BWnzrR2N44EfgRnr6I ZOg1wEDGuKmKA== Date: Tue, 20 Feb 2024 08:24:44 +0000 From: Lee Jones To: Kees Cook Cc: James Bottomley , Geert Uytterhoeven , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Finn Thain , Michael Schmitz , "Martin K. Petersen" , drew@colorado.edu, Tnx to , linux-scsi@vger.kernel.org Subject: Re: [PATCH 03/10] scsi: NCR5380: Replace snprintf() with the safer scnprintf() variant Message-ID: <20240220082444.GH10170@google.com> References: <20240208084512.3803250-1-lee@kernel.org> <20240208084512.3803250-4-lee@kernel.org> <20240208102939.GF689448@google.com> <98bdd564c6bf1894717d060f3187c779e969fc5f.camel@linux.ibm.com> <20240219152312.GD10170@google.com> <202402191328.8E1A325@keescook> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202402191328.8E1A325@keescook> On Mon, 19 Feb 2024, Kees Cook wrote: > On Mon, Feb 19, 2024 at 03:23:12PM +0000, Lee Jones wrote: > > Adding this to checkpatch is a good idea. > > Yeah, please do. You can look at the "strncpy -> strscpy" check that is > already in there for an example. > > > > > What if we also take Kees's suggestion and hit all of these found in > > SCSI in one patch to keep the churn down to a minimum? > > We don't have to focus on SCSI even. At the end of the next -rc1, I can When I've conducted similar work before, I've taken it subsystem by subsystem. However, if you're happy to co-ordinate with the big penguin et al. and get them all with a treewide patch, please go for it. > send a tree-wide patch (from Coccinelle) that'll convert all snprintf() > uses that don't check a return value into scnprintf(). For example, > this seems to do the trick: > > @scnprintf depends on !(file in "tools") && !(file in "samples")@ > @@ > > -snprintf > +scnprintf > (...); > > > Results in: > > 2252 files changed, 4795 insertions(+), 4795 deletions(-) Super! -- Lee Jones [李琼斯]