Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1376842rdb; Mon, 19 Feb 2024 13:31:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWr49nQz6EChLzY+KBFHNud0+nVPd7E47pE05NZ4UWwXLvxyr66fobbvyIjJlZYp/0TAu63bH7lDjs8BHv6fUwe5LFkV5yxLpfZGt29/g== X-Google-Smtp-Source: AGHT+IHl6p2TlTSXkLiB2qyoT7/lhobSXC85aqzDwFAv8JSwjtILpiaBa2w1AeMgR8vA85H9/EhQ X-Received: by 2002:a17:90b:4016:b0:299:6717:e1d6 with SMTP id ie22-20020a17090b401600b002996717e1d6mr4098109pjb.15.1708378273890; Mon, 19 Feb 2024 13:31:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708378273; cv=pass; d=google.com; s=arc-20160816; b=J9ZfHFPnwAK3K8UV1chj2ICj87yvEpljju34JcfwPBmyjp0IgpxWVfap9lpLQk/4+K b1zoTcjdSa1EI8wXM6aPYPwSA/qrFW2KVdr2mn18t8yWTZsIBL7ntTlO6KWBTyy2waOX 6g8h1aXcDjIVpecsMt+vQqupQ3NH35eDPvMyqGZlmv/hEJ/6hgyp9Mwb4SD19ZI11Ldm CGCzVDbI23o7OeBuv2HaPXRoTN5B33PfiDipbR9sUC0rw3gAccjeCdv2vWmnUsg7KtQt om81+iUYSCSW2AZWeh+Wii7KdUDz0uQ/1f21tfLYRfNDyJNSfhGXmQWkhFf2htc9ef+8 QXzg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XLvvJpjFswKgVoEBvb+c2q57/k2FJfy6sWagye6yyVc=; fh=buSSffdYmfT9YliDkDex2QbubWG/SdfeYuk0mxOgUXo=; b=QkKOhKyZkaszB2XK2cXH+ui/UOaQwy1cbDARJC1vP95AHquuJ4OfPRjHU6JPkJSJZZ zL8GiTNhk6kKe14FWFPXgSqKJQKGLZpKPlcHTNbcT/JDEmjKq7viYCw9XueWhfxrQnXL EFRFh1C9tpt5ZUXD2TgHSEmpCreKjlIUMs52uQkbhFhmbJ++H5YkyVgbmzd3uNDuS9+x MzLpATaCE1/cLaDMusIiFPRpSXkA+ptmi383JweHxLJdg3CgbafQdzWVw0pEGgpIzVce UUCgalMci4tTjUn72muGXnVHQiHS/r3NrCnQ0BGoQ64OJv26qhwN1HuCPwEzqhNLmYcO zv6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="VO3/rqEa"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-72005-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72005-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g8-20020a17090a128800b00296e784edc5si5108836pja.144.2024.02.19.13.31.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 13:31:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72005-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="VO3/rqEa"; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-72005-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72005-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 96F582836B6 for ; Mon, 19 Feb 2024 21:31:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D5D895478B; Mon, 19 Feb 2024 21:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VO3/rqEa" Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DA95537E4 for ; Mon, 19 Feb 2024 21:30:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708378261; cv=none; b=uA/riMTfFAFVDk7nh8Sye8OMxnMOYq7CA7A+PQtSFPyW7uCMI3bBfQPwzciB8I69/28mp3cLCspsF7SgaADNeqz/832YAjoeNk77412PoIZ4vytrWTlWaFiudSviaQNKa7it1Ro3JxtxR4xgdZm+hOZTWBXNH0u8EYIH/XqVXbk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708378261; c=relaxed/simple; bh=aoPIAPeIcMZ3O8NtO4F6czhuBJaXTuwiOia7AEB4YqM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cbBi2VwEftehf16j5IaYOY4jPOBnRjMwuY8qBNp3iMz/xSfdh5kWGV28esRLr6UgCAppeQYi6XMhpEyPHeosCtuGTjWYYQYupevn/bkP3/1WnU0cKPsV8u1d5CGI5SxXVU5KTICh7umXP4cl5nitoIFr7dX/EAcVxcvJUII+I68= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=VO3/rqEa; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6e458a77be3so457146a34.1 for ; Mon, 19 Feb 2024 13:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1708378258; x=1708983058; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=XLvvJpjFswKgVoEBvb+c2q57/k2FJfy6sWagye6yyVc=; b=VO3/rqEaNssd4CqzfdZFhtXWUQgM9bor7ZFWJMTNgyAJqmENKo2EYHF8SQYasnFe0w ohnxB1gP4qXNkSpGUHemAybnaspPN8pRBy9uipqUQ6rxDbe8kovbMSTtbfCH3EQQbx2L g+MDB2YOR8jBmediDxnH8UFZyGzFNuzK72XbY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708378258; x=1708983058; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XLvvJpjFswKgVoEBvb+c2q57/k2FJfy6sWagye6yyVc=; b=ZereBTZPPiDo7iXMEHIqUakKvU/j0Cu1SyAfAqQsZuQo6R1lvtZd/CA6wMaCfFHD+a V4OojHokQgMAw36NGY68pDOdyy6eYly0fqDHhq9/w2RkQuO+TIEJeuFwzYOTN2cpxDfC QrFVNQ5BbjlOzb8HoL/qHaXH8i5Qcgzj3fBnCrabXDvWQUFzqqarBbj9rgZigWBuS9WI Jwqj5Ry8dt70dBgkk2OqaHjpOoQeDTXC+k3DwTZcTBqOPsHJiXEcvwu3I1AnvMhTDN6H 8+aUNGuITQyXZWqbMLVh5ZUxUdA+VfyoBH0V3eHtGs34Hwc96KI3yDMxnHPP6QYN22DW tSkA== X-Forwarded-Encrypted: i=1; AJvYcCWFEvZS7HuYo6+fWveYboEqHBlbL4pwmYCKDE9ULtICX7V9WdOZDfCY8itIbttU0QugJaAIp0np0rG0OP174CCiap7sN0OsbdrlTZ/V X-Gm-Message-State: AOJu0YwRcpv6OwwuAq0qKz3WzKMLtpw9UalbYlAcVNK1qWsa63QO7SiR ZhiuUgw4w2bkBH4D4HrRDCI2UJFjoswFJRgtUQhjS3PSMyWLJsOmO5n6UYXFcA== X-Received: by 2002:a05:6358:d26:b0:17a:c976:c143 with SMTP id v38-20020a0563580d2600b0017ac976c143mr15279982rwj.12.1708378258679; Mon, 19 Feb 2024 13:30:58 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id o23-20020a056a001b5700b006e466369645sm2065885pfv.132.2024.02.19.13.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 13:30:58 -0800 (PST) Date: Mon, 19 Feb 2024 13:30:57 -0800 From: Kees Cook To: Lee Jones 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: <202402191328.8E1A325@keescook> 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> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240219152312.GD10170@google.com> 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 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(-) -Kees -- Kees Cook