From patchwork Fri Feb 23 22:23:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Stitt X-Patchwork-Id: 20903 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp874475dyb; Fri, 23 Feb 2024 14:23:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXQk+xOqQKD29038q8U3U5EawbzUsWpIiF39ZKADx0fMw4xld9n5TiqdCPoBWfyvC1yyPA+51BlcYdPzgIHcA08P3I4Vw== X-Google-Smtp-Source: AGHT+IElA4592xetuHc4Heym87TBTZSpskO04OtrXDK4iMYedYvvcwr20icZKAuUP1O/m0Faz8l/ X-Received: by 2002:a05:6a20:a989:b0:19e:98a1:1160 with SMTP id cc9-20020a056a20a98900b0019e98a11160mr982103pzb.28.1708727031461; Fri, 23 Feb 2024 14:23:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708727031; cv=pass; d=google.com; s=arc-20160816; b=XGUymtjixqtdUKBBnDoN6zFaKYnDNZLPVVtFWliGM4qkFtVtB3+fPxS6+0TS9IqsLl Cuz1QXyboJ466XL7OqZv4tO6ARvcxrwJFz97tuz903rkoM63B7tv2gNoxEgPfG5+ez8V 3zz5SJcmJAkd9MtU7mIwsFaDA3nzoc2y5zypYdMZbfX9plF2ylOIy9TefXNLy4wvkDoZ kFOrwzpF8nIa9vlQhO19MTfD1vcHh2k2X6Wwlm4DCCKvhxjF9TJm8ZCGdQ9zfWazX0yM EwXvuNi9gCfFAZn6khg26/AMDP+1VeTDWUmB8zGkzmskI3Krz3AhxneK7C2xp8XiSDF5 RqMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=D+qlm5aO/aQ4uIkmSxxKlZZ/tyfKC6M+ie/SGRsUmdY=; fh=t4nWVMHLeFVh0rsgMye5EtLLqWdMUS1F1ekiHm5LDbw=; b=JMjqzcTVz4Qd9yc/amaT9CfD4ttwYWVClUfF+sw62TjDNInKnRrjN8JOIAipqToJ1a iFq/ORRsuubJNxMAIKLSrFv1z8Zv0PI7i0TJLrCIq4ZmiKaswrqs+jb3BEykPR2ngSsK 9g+PvEuCWrtdCfAVHxLdFFwmGlh7ls9DfAbNvD7HB9wLj0Q0yJVy8pbfAoLhJIQTDdFN CzEzEyjIivm6VmXHq4FduLJ59gcqGcWFTOy9Cj7xyKyWcLdR4IW1x6rZ+WcK+QHZHzhi RyWzEpjLjwBxvORBeyYVIEA/BBLmsl3yan/M0CDdKHMsB8dZn4vCdbAE09xdugPv5Vwk UVVg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=hY1blRTU; arc=pass (i=1 spf=pass spfdomain=flex--justinstitt.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-79249-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79249-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g15-20020a63374f000000b005d7afbb31b3si12696758pgn.352.2024.02.23.14.23.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 14:23:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79249-ouuuleilei=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=@google.com header.s=20230601 header.b=hY1blRTU; arc=pass (i=1 spf=pass spfdomain=flex--justinstitt.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-79249-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79249-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 D6C18286D61 for ; Fri, 23 Feb 2024 22:23:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44D0F14EFCB; Fri, 23 Feb 2024 22:23:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hY1blRTU" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 4B6C01493B4 for ; Fri, 23 Feb 2024 22:23:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708726994; cv=none; b=Rv2Bh94BmTPA8yIuYi7Q0bz5XM7W2iR2/EaeUCCCe5iPTT20Aosfj3788CeDdwdcSBAgmO3LGqTh5vUE1sDQdoOx49c3ANfxdt4qhL0rARQ1ggw/oAJAkb4s1jNxiKbVH5ZVGKSyy6q9damN11qhe3q8u6nhzlp3hpxOzZyckJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708726994; c=relaxed/simple; bh=jZLUyLw+PYly8jkRw97FHtiAlxLeYw/ruqpi5XPfw0s=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=HHC/TRXnTpbAB0pDdxmFeAWiErn/iXuNcRJANT6GH4kS9keT8Q1XDgRLCsA3YzXxAJWOXo1mlVTeRnWxX/ruXq6OnqU0afiYeA+KzQOQmu1x0v6i1/l1pmH8hZJvCW3uaszsjOvRMOWyPHb1Jv82URnD18aS3feruoGDCFNqyxs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--justinstitt.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hY1blRTU; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--justinstitt.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6083fbe9923so25905327b3.1 for ; Fri, 23 Feb 2024 14:23:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708726992; x=1709331792; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=D+qlm5aO/aQ4uIkmSxxKlZZ/tyfKC6M+ie/SGRsUmdY=; b=hY1blRTUIu/7qOkJO+c+Mx8xrzFy8m3C4BfImk4ERUZLeBrmqReZ4BKI6Sd+j650CK pTuDfL+n/SWYEB3Qrps1id7GSCoIc/74zw5ziizUb9w6JcSFTQKsWVbEZG7gaXmPXgcl gxEfueKbdrdzKoQwOT4ndWRR0XV7vO39pquNcqo8fJEOe5TJM6juQsxChOf3sArCIVkH QC0JVFIQoLycFBQ6wXaAu8RrfX9mAy65gr6EKryWk2Ui2D4CPzTMu5YMb5LH3cY9FPFB ZSNLyJGsW6Gb8mo11uwCvQw51+UIi80x2QH8pT4TUMJZMdh01TFl0djdBidcm9P7/NdY J/dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708726992; x=1709331792; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=D+qlm5aO/aQ4uIkmSxxKlZZ/tyfKC6M+ie/SGRsUmdY=; b=ifkZKaE56FlhL/Qg40hxuVPkHvDKfpXeNoubsNUemMZDLUGuxHaXWXg0tk3ojeH1/j Z5ypAh6thgrQrJE0PgoF+vKAUY7JoYyx0qY2mL93CwqwDjlQFng9xZBaMj73eKK/56tC AVZaJsuD22R9XXL4W8szHGqt/Mjisd675eAMqcA3yFhQ0GGJF6xH/RiasclWe4RR29lE RVc4zDBE68BeO1zj+WTOw1Qc8Qdtxgp9JrSJUsFE/KkkOrGuu6gL8yKGFJWLiOCrwOOu +Q1QgVLGQaYLOAjgV7LSen9CbeRaeExAS2BAVIHjaNwfrnN5fnUYVNrYnBNd/eVVho3X oOVw== X-Forwarded-Encrypted: i=1; AJvYcCUlpzjGcHuhbTXoi3ktDQPXxaUCkgw3KcMUBXUXLvAmUtP8lvmYR5SKhZ3xMIYUfi6rdUMSw+ex2gIFs4LpCHz0Ly+bHBGfUCS6cskF X-Gm-Message-State: AOJu0YyW126j5cQ8FJ7ECdl5y15epIQPVSEejdGVd080HJGx0zX4KHs3 5VA9dM25NqPOFNAHCbyqx8sPA/0aL9Y8Kkxsk1BSIKCTGlugWI3ma9ZQ3O4TdF1xNr9j15JzjP3 x5ILZUYDawuZjcqAsz/Hp/w== X-Received: from jstitt-linux1.c.googlers.com ([fda3:e722:ac3:cc00:2b:ff92:c0a8:23b5]) (user=justinstitt job=sendgmr) by 2002:a05:6902:188a:b0:dcc:6065:2b3d with SMTP id cj10-20020a056902188a00b00dcc60652b3dmr305504ybb.8.1708726992262; Fri, 23 Feb 2024 14:23:12 -0800 (PST) Date: Fri, 23 Feb 2024 22:23:05 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAMka2WUC/y2NQQqDQAwAvyI5N7Ab9eJXpJSajTUHt0tSbIv49 y7S0zCXmR1cTMVhaHYw2dT1mavESwO83PNDUFN1oEBdICL0l2UuX0ymm5ijsyuuRdvV/rjNb2S MU2xD6uOUmKHWismsn/M0Xo/jBwE0zgZ5AAAA X-Developer-Key: i=justinstitt@google.com; a=ed25519; pk=tC3hNkJQTpNX/gLKxTNQKDmiQl6QjBNCGKJINqAdJsE= X-Developer-Signature: v=1; a=ed25519-sha256; t=1708726990; l=1611; i=justinstitt@google.com; s=20230717; h=from:subject:message-id; bh=jZLUyLw+PYly8jkRw97FHtiAlxLeYw/ruqpi5XPfw0s=; b=wIzkR9ttslj+b0wOPreTc5A7WUjUtgLZ2xJXIkoRRFJsTFFrBDRhsGJXQELHXar8zcNXJPLEG QWJPhdh/60KA1FJbeNXbShCZBnrhP5rvNT8yLUyTqCnRH04Xdhxj2KG X-Mailer: b4 0.12.3 Message-ID: <20240223-strncpy-drivers-scsi-mpi3mr-mpi3mr_fw-c-v1-0-9cd3882f0700@google.com> Subject: [PATCH 0/7] scsi: replace deprecated strncpy From: Justin Stitt To: Sathya Prakash Veerichetty , Kashyap Desai , Sumit Saxena , Sreekanth Reddy , "James E.J. Bottomley" , "Martin K. Petersen" , Suganath Prabu Subramani , Ariel Elior , Manish Chopra , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Saurav Kashyap , Javed Hasan , GR-QLogic-Storage-Upstream@marvell.com, Nilesh Javali , Manish Rangankar , Don Brace Cc: mpi3mr-linuxdrv.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , MPT-FusionLinux.pdl@broadcom.com, netdev@vger.kernel.org, storagedev@microchip.com, Justin Stitt X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791730155577202217 X-GMAIL-MSGID: 1791730155577202217 This series contains multiple replacements of strncpy throughout the scsi subsystem. strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. The details of each replacement will be in their respective patch. Reviewed-by: Kees Cook Reviewed-by: Kees Cook Reviewed-by: Kees Cook Reviewed-by: Kees Cook Reviewed-by: Kees Cook --- Justin Stitt (7): scsi: mpi3mr: replace deprecated strncpy with strscpy scsi: mpt3sas: replace deprecated strncpy with strscpy scsi: qedf: replace deprecated strncpy with strscpy scsi: qla4xxx: replace deprecated strncpy with strscpy scsi: devinfo: replace strncpy and manual pad scsi: smartpqi: replace deprecated strncpy with strscpy scsi: wd33c93: replace deprecated strncpy with strscpy drivers/net/ethernet/qlogic/qed/qed_main.c | 2 +- drivers/scsi/mpi3mr/mpi3mr_fw.c | 8 ++++---- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 +- drivers/scsi/mpt3sas/mpt3sas_transport.c | 18 +++++++++--------- drivers/scsi/qedf/qedf_main.c | 2 +- drivers/scsi/qla4xxx/ql4_mbx.c | 17 ++++++++++++----- drivers/scsi/qla4xxx/ql4_os.c | 14 +++++++------- drivers/scsi/scsi_devinfo.c | 18 ++++++++++-------- drivers/scsi/smartpqi/smartpqi_init.c | 5 ++--- drivers/scsi/wd33c93.c | 4 +--- 10 files changed, 48 insertions(+), 42 deletions(-) --- base-commit: 39133352cbed6626956d38ed72012f49b0421e7b change-id: 20240222-strncpy-drivers-scsi-mpi3mr-mpi3mr_fw-c-1b130d51bdcc Best regards, -- Justin Stitt