Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp767578lqh; Thu, 28 Mar 2024 16:19:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfvJjf3QhvhxTAPE5GeE7BzuduAHxn9evTT4RnlijTma5sAUVB0jtBteobwMFtEKOK81hsOEzayhw7W1NUWH76XyyePR8q1JgOVw76PQ== X-Google-Smtp-Source: AGHT+IGU+d8EtPnVEhPRUgPLKgKJGpfhP5Amxlmb57HmyOfX4xh1PFm5QEZFj0r26QVUQM4XPtWQ X-Received: by 2002:a05:6a21:18e:b0:1a3:b05a:52a5 with SMTP id le14-20020a056a21018e00b001a3b05a52a5mr5376486pzb.20.1711667956024; Thu, 28 Mar 2024 16:19:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711667956; cv=pass; d=google.com; s=arc-20160816; b=fdzX15gt8TjpeJfl+giO/opJeXZJIkx8I6S9pDvbB7aDdSSGO01iUOOzC5Ocj44v2D ldvNVzE82yAUS6mlrI1lpvMaZilVbSpHpbhqBpF60jPJOsN1ydKyJpc3eIdicr9mXew0 M07EdLTqKB1fBz9esRXe7YnU3gD5Rf1JyOF1R3QUbD1Pgwq9IHlMolJpA9hwbKglpciO V3rzup9xLUpZtcyfYtko/fY7l20cbKmRrOsKDYb/xxKcsPxKYcXCpbNnhbCl0PnQCu0G Cv+bHH1J1UkyOWm4MjFhWbF7OQcH8w5ofsUUF96JaL7n+yy2mJudgECaEEupwTEJnVCd NA6Q== ARC-Message-Signature: i=2; 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=cHVhiRJg3yoWV/TXtcjf/4iVMYBasTwoLlZblDkJ4RA=; fh=jsm4Hh7BXHPPVVuz7VJksZh3WQXx/zHjakX5zlngUAQ=; b=ylwfTzDGvh/oOD6ztQiVm/uuYY1pUIFtUT6mtIAAPAm66pfwUk+vKJTElwtyLs7v3x 6BfGGU5cf+KtF6+ASFcI1kuBKDqt2pUy/p3ukbue+fJxDE3d+8l5TvtbLSYgXjEou7cM R1pGpOILMQjmEfgW+el+Dnx/HcibPhVLqgYgiJXGaz/a0L4vZoRtxxSP9JvLkVlOt8e1 7X+HnNq2Ay4m84onbDLdw9K9IwJJsMKqa4IwY3XN+3zT2/tEa9k6Nfe0oGgDfVFslPmy /INZ80M3crqIqK5n4MpS97JTXeZZpeUiMMZ3FBU3eoRm9LXTkvb+hzGYEC+k5fWmgzv+ qikw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=ad40VaPh; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HwPTUbNX; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-123815-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123815-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b27-20020a63715b000000b005e425bf0f0esi2307812pgn.830.2024.03.28.16.19.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 16:19:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123815-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=@arndb.de header.s=fm1 header.b=ad40VaPh; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HwPTUbNX; arc=pass (i=1 spf=pass spfdomain=arndb.de dkim=pass dkdomain=arndb.de dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=arndb.de); spf=pass (google.com: domain of linux-kernel+bounces-123815-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123815-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B2DC92852AC for ; Thu, 28 Mar 2024 23:19:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0633A137909; Thu, 28 Mar 2024 23:18:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="ad40VaPh"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="HwPTUbNX" Received: from fout7-smtp.messagingengine.com (fout7-smtp.messagingengine.com [103.168.172.150]) (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 3AC4539FDD; Thu, 28 Mar 2024 23:18:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.150 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711667910; cv=none; b=WiXCxLlWflB6duvq3xRL6Rts9xVUCzFHfoOJblX7es7mUwr7dC2FNw/dFjJ2rVNPTofIDgYslSOn/2bDFCHNIRc7HGH1Rejd4UB5Q134gUP9tUdkjSt0s8MojH/VnU66Vm/AHeiwkDYz7JbdHjkB+/uBWVYx3r3W8d6WE3o2Zog= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711667910; c=relaxed/simple; bh=KOaINKXdpcVFV7F2AKxfl7uztaO+GqjjudMvUNQbyJM=; h=MIME-Version:Message-Id:In-Reply-To:References:Date:From:To:Cc: Subject:Content-Type; b=GocDWTM4oqdX8CHernQMM2vmBYDdUBNRDrm2CtsXXOGIChsdnzjIMXKEF/GEDr330sxNPT1yBuL7BpPGTCKfYZrb2maw6f2NWXZcA43+8QdnHB5TwAAJloC+g54mm5T6LlTZcizmhP5bwvQNwzM/ez0MvbJEqFlxifRJWKRnRGc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de; spf=pass smtp.mailfrom=arndb.de; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b=ad40VaPh; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=HwPTUbNX; arc=none smtp.client-ip=103.168.172.150 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 mailfout.nyi.internal (Postfix) with ESMTP id 1F70D13800D1; Thu, 28 Mar 2024 19:18:27 -0400 (EDT) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Thu, 28 Mar 2024 19:18:27 -0400 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=1711667907; x=1711754307; bh=cHVhiRJg3y oWV/TXtcjf/4iVMYBasTwoLlZblDkJ4RA=; b=ad40VaPhRu9xSA4WNIbnqsmNrX GGA3bW8UCcQZ+rRK5oEj6H9zsnZIasnNy0xmC8Eu0jiHuX+Tdx6Fojc2DLvq5rBP oqMj9RgxAGzLWEzlaKbqFGIeAceXhGAUlLGrJRCvWmqJPqxV70tpCkOcNQqUDKQg JkYqUO0UzrppBIHOKett+B8duGQUpes75uZokx+uw/AnZkACDrZXhEJU4zMOjvmW kLUAc/t/3dkn22m14/YqybKyFYfsuujaTtWFil/mMMKqShxlI5HHaU10PKVxupSj Zc3boOorLxzqCcVSbtlqd+cjiL+3EHKqX49JHiZq0diufqGUQvR68lY4IX2g== 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=1711667907; x=1711754307; bh=cHVhiRJg3yoWV/TXtcjf/4iVMYBa sTwoLlZblDkJ4RA=; b=HwPTUbNXkiacbKSY49zz5LWFGH3gy69gK2PImqF5kRmN /VMf92nuMewwllCr2mxeXh0Rj1Vr55mwg1u7EXmY/daLNvBWIoua+UjcdVNeRTcK zpIgPn7JkDKz9VSMIIXCncV/UC2UTUNFaPb7cg66tYGAKD0MXPwM3b+J75cK6+sq RVnR0sbPhvrQQSf1b9AA/phn3xIh/AtFHxUZkd0w1WZu+SH2jKH0hny6dYHnuC6B Kldc6BJrqtXWKIV5+Ahmn9DwKN0tXucl1pw7YD8CSQEb7avxo6+hsyVeEI2/hnmW O0D6F3UFp/ddyApnHFWZXzhccZS53dmiixZD+is3yQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudduledgudeivdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeevhfffledtgeehfeffhfdtgedvheejtdfgkeeuvefgudffteettdekkeeu feehudenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id A707CB6008D; Thu, 28 Mar 2024 19:18:26 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-333-gbfea15422e-fm-20240327.001-gbfea1542 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: In-Reply-To: References: <20240328140512.4148825-1-arnd@kernel.org> <20240328140512.4148825-3-arnd@kernel.org> Date: Fri, 29 Mar 2024 00:18:06 +0100 From: "Arnd Bergmann" To: "Justin Stitt" , "Arnd Bergmann" Cc: linux-kernel@vger.kernel.org, "James E.J. Bottomley" , "Martin K. Petersen" , "Chris Down" , "Petr Mladek" , "Bart Van Assche" , linux-scsi@vger.kernel.org Subject: Re: [PATCH 02/11] scsi: devinfo: rework scsi_strcpy_devinfo() Content-Type: text/plain On Fri, Mar 29, 2024, at 00:14, Justin Stitt wrote: > > On Thu, Mar 28, 2024 at 03:04:46PM +0100, Arnd Bergmann wrote: >> From: Arnd Bergmann >> >> scsi_strcpy_devinfo() appears to work as intended but its semantics are >> so confusing that gcc warns about it when -Wstringop-truncation is enabled: >> >> In function 'scsi_strcpy_devinfo', >> inlined from 'scsi_dev_info_list_add_keyed' at drivers/scsi/scsi_devinfo.c:370:2: >> drivers/scsi/scsi_devinfo.c:297:9: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation] >> 297 | strncpy(to, from, to_length); >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> Reorganize the function to completely separate the nul-terminated from >> the space-padded/non-terminated case. The former is just strscpy_pad(), >> while the latter does not have a standard function. >> > > I did the same in a patch sent earlier (few weeks ago): > > https://lore.kernel.org/all/20240305-strncpy-drivers-scsi-mpi3mr-mpi3mr_fw-c-v3-5-5b78a13ff984@google.com/ > > Maybe reviewers can chime in on which version is preferred and go from > there. I'm in favor of your version, it looks nicer and addresses the comment that Bart had on mine. Arnd