Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp3056496rdb; Fri, 22 Sep 2023 17:27:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKUcC7CY82TUGCvK9dvtga1VOrr9CRiGI505E9XY1rnxHlKTREScpicl39rcl/eqyhTpc9 X-Received: by 2002:a05:6870:f691:b0:1be:f720:bb7b with SMTP id el17-20020a056870f69100b001bef720bb7bmr1174814oab.16.1695428836257; Fri, 22 Sep 2023 17:27:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695428836; cv=pass; d=google.com; s=arc-20160816; b=OGkI9tjZrTBgf3bXpgi1ZdQ7h+vJCAz2ZZoWMN4HXK9PqdxjNxWaQ7G//t5cdMFvoq f9w2BLmdMkzm+cOrplPHVONbg8tRzvdaj4spZnF8Dq3ZKE9nLP2eqDtaT5D1wtZdw1QQ Ft+KHLNB+Kkq8x6x91yU7sx7kUqxQVBT42H3UeQ6aN6Jt4bGp75BvrL77IMR/AFugMpe pZjXUwaLTEY0GZdd1WttuOS4m59C3VLCbM6eON3wscXChN1Q5Zb6qYns2OfokUehJQDO 1spLQ+4IxPOq7ogmr/+AVpYGIEiJ39d9UYOrZ8Fr/19zs2QCWSNRdb+rJXkNmzB5Dvrn p6nw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:content-language:references:cc:to:subject :user-agent:date:message-id:dkim-signature; bh=NpX7eimeoLzk7Re1nJAR2pc3RCXMGHpbWAghz1PzXTs=; fh=fruxgRvTYn5sSJ7ulsGCAuAPNE/XnS0qOnVcD50Q7Gs=; b=h54S+lyawbGxUEV/Q2znJyWLJ2wj9ClrUcXAqAWzVS7RxFnyG2K/q7QNc9HPCxsui6 p2sV2Bg22GaKQzqEaQt/zqUe5cHirviYyS+hH5LkkrlEL4AAyJWE05bEdsTpUqnUIkW4 wxJ2CnRjPnvG+RRRVUeJsqk+TtGioPx4r++8OKzg7sRHPu8Oa6UUvnjaFvKjoM/cdNpi 6j9FuiXuJdqYKWKb6pl3z947esqztLkVWbnhrGNDzxgh0R0hygTDPN4cRJp9P2Y8gCcQ 3IPmarURqHhJoNT4/liKiX/AUFgkcnSvx6G/B9RsvRzUajqCPShuznp1lsCenKX0JUOn BOVg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cornelisnetworks.com header.s=selector1 header.b=DSwnP8yV; arc=pass (i=1 spf=pass spfdomain=cornelisnetworks.com dkim=pass dkdomain=cornelisnetworks.com dmarc=pass fromdomain=cornelisnetworks.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id 64-20020a630043000000b005688117c6f9si4694829pga.44.2023.09.22.17.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 17:27:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@cornelisnetworks.com header.s=selector1 header.b=DSwnP8yV; arc=pass (i=1 spf=pass spfdomain=cornelisnetworks.com dkim=pass dkdomain=cornelisnetworks.com dmarc=pass fromdomain=cornelisnetworks.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 44FDF8065337; Fri, 22 Sep 2023 07:25:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234146AbjIVOZz (ORCPT + 99 others); Fri, 22 Sep 2023 10:25:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233368AbjIVOZy (ORCPT ); Fri, 22 Sep 2023 10:25:54 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2097.outbound.protection.outlook.com [40.107.93.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41993C6; Fri, 22 Sep 2023 07:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i9DUkVSkNDl5HKSVl6wM+MK9dpG2y4Wdr5Y2gmdo9YlcVIO65vxcS3qwucC9AySzPpp121MGaHtCxK2SjwC25u0gW14LGmW1yfJJexffJyyMXEYICf8ySFR9gHoTFJzdDVqK0p1zuypDeCOdIIRXR0fOA1xLER5gg4yd4YBhAUXtDcghW0TFKiCo+82Co4oqdzmmdSq0dmVJLgmHC4QEPmgr7lOD4lUInGewymVfR2hBzbUizLhKYfZBMYxusa+Aub67v8asdbos8NO7FWO8nY/6InXMJk8izlkYu1H1z6MDp+J1XEJtfFtG6kriuVrYBvbqWQKKSzuuKV9mmBuHGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NpX7eimeoLzk7Re1nJAR2pc3RCXMGHpbWAghz1PzXTs=; b=OGW4vDt3WeflAHelisu4L/sfvhW6LrQVbsw0SCM/fDRflpYv3uRmUE/pCupZubg/WSvqZWpWYnqi4TJQWpy4gSML3CZdKwTT/v8PKgbtcG78XLe2fZi9QhxYBow+ukvqcSk5cMba6Ll246u2QU72YMrj/RK0dUsukSvbdEBILzUrrlxfnjcrgc677lO2U7FYxizpoJ/2DLUQ9i17Ezo+lbj0p5/rmZf/c7oao7T9Ir8O1udE95ZHJ1CctSg///coPIiAnn9zoq+LIrla2WMclRiQl0w+OhGhSbhksbzU1WUJFzyxtSN7M6fuWfxIzuIA9X/eExgLrvo0/N+WiInNHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornelisnetworks.com; dmarc=pass action=none header.from=cornelisnetworks.com; dkim=pass header.d=cornelisnetworks.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornelisnetworks.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NpX7eimeoLzk7Re1nJAR2pc3RCXMGHpbWAghz1PzXTs=; b=DSwnP8yVuvM1JH+A3TdIJDmj6tTX8UDE14IiqtWqg0U22xVqVuM+khqBWR4mfurq7QRi2oa/VSMK5sHCxn7RHM2si3JSj4ULpypEGsXIvPuUZ1S4mkqhSZW6ZufqpxGE1t0LVacwhzDPHjYqP30TdZQEb4i4P2J3tOzfMgYSYnmcgIWBAKcpM6j5eyl+ebYc01h6IOBgLTmWq6NJnRDLBiBiqna5D6SyGN7fRerN5C+9k18/pppzWicvtVtWMjffUCxLGss5EfZNTjS2W57VOoMfoF3PBBlVAaJh/e668zp+8MK0kaByzVshF3Agirv9N2u/7PhQmkImXBbaTrR0cg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=cornelisnetworks.com; Received: from BL0PR01MB4131.prod.exchangelabs.com (2603:10b6:208:42::20) by BN0PR01MB6943.prod.exchangelabs.com (2603:10b6:408:16b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.23; Fri, 22 Sep 2023 14:25:44 +0000 Received: from BL0PR01MB4131.prod.exchangelabs.com ([fe80::386c:b0e1:bf68:cf1]) by BL0PR01MB4131.prod.exchangelabs.com ([fe80::386c:b0e1:bf68:cf1%6]) with mapi id 15.20.6813.017; Fri, 22 Sep 2023 14:25:44 +0000 Message-ID: <2f4bd46c-664e-4253-8d57-16bd46dd3be8@cornelisnetworks.com> Date: Fri, 22 Sep 2023 09:25:39 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] IB/hfi1: replace deprecated strncpy To: Leon Romanovsky , Dennis Dalessandro , Jason Gunthorpe , Justin Stitt Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org References: <20230921-strncpy-drivers-infiniband-hw-hfi1-chip-c-v1-1-37afcf4964d9@google.com> <169537858725.3339131.15264681410291677148.b4-ty@kernel.org> Content-Language: en-US From: Dean Luick In-Reply-To: <169537858725.3339131.15264681410291677148.b4-ty@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: DS7PR05CA0083.namprd05.prod.outlook.com (2603:10b6:8:57::29) To BL0PR01MB4131.prod.exchangelabs.com (2603:10b6:208:42::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL0PR01MB4131:EE_|BN0PR01MB6943:EE_ X-MS-Office365-Filtering-Correlation-Id: 33dc326f-0c99-4fb2-a4a4-08dbbb77ce0e X-MS-Exchange-AtpMessageProperties: SA X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /NV8lURWjbf9BUNDhXerdbm7VrytrRkIxYpFhjEo+LhqNevVdOfoeWFZOnSqoY9z6kYTL/s5BDP8YdCbe6BDgpDNBMO3bW3jkw/q5h9iSX0kVlL+A0iZm1HnosLoMKNLofVmwFknsuWA8p1pNhVBFzbYoGjZbkESbGOAoBZ2uU82+VB4zKsJ6tdxSAyLmIH1GC0UfY06XEIGhAqDrZQ6HxanlTM7R9pqZ26h1uGRJN/roqCj+eiFyBjMhldogntrCen1R1wHwmPadWqGYE3i5fEvfxSGNCbreEx0jRM2YcHJI486fQnLe18Ddw7leyDq09TYUgFw/ZkZv/Ir2St+A3dO4EobWQS0nz0BR/9bYGXHaG9gPb63D5/KC0wU94Xgaxgx8qme4MMoc2wSCKwLr9NmCNXoeVmrg+2v/teqKQyLmaMC8RkP3aja69aeLBMLRnKWfy4Fjxftl7ZNxkWqkHgNjleXTEdyxk3U+QH7ABy6oncPBIhz2thfyOPnCTgaq+k9zIGb7MdpeLE4yj0NQLIz6G67KxnmXGf8zdOGze6S4/r/x3LEloRWygE2WOL3/aILp8i0mK863l+AV9l+TO1t16V5tEW4zavHeOomFpogZWVZE/gquca55WSCP+ji X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR01MB4131.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(39840400004)(136003)(346002)(396003)(366004)(376002)(1800799009)(451199024)(186009)(4326008)(6512007)(6506007)(8936002)(316002)(53546011)(8676002)(31686004)(44832011)(966005)(110136005)(66556008)(66476007)(2906002)(66946007)(45080400002)(2616005)(6486002)(6666004)(478600001)(26005)(41300700001)(38100700002)(31696002)(86362001)(36756003)(5660300002)(156123004)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VEFTc3NxREdKUFVEai9RNmV6aXFzSWF4VkNKU1BRYlEzcWdFTElyTVRwOG50?= =?utf-8?B?dW5kUDVZUlR5dFZMUHExVzh5eFRRZWk1QTJQK0lPRC9lNVZjZlE3MjRTdmVj?= =?utf-8?B?YzZEamVZOTIvVDBDa2JRYWtzSStKZlNmTlBpUWtBRkkrNHFqY1lpZmZUb3Ay?= =?utf-8?B?Nm5RMjVCRUI0WkxIMjNVRE4xc2liczJxWnZhbVJYdEJBd1p1Q2xjcGlETnVx?= =?utf-8?B?b2RzM3hv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2lHYlUr?= =?utf-8?B?NFVzQXhmL2FHbkhqL0xvUkR2TlQ4dkxuVWorQ1JrSWFCUldJVitISTFWMVc3?= =?utf-8?B?aFIzNWp0NzdKNFlBaGY5Qm9haHVadkF4c1F2T3pJMDk3WmdDS004NmYrVGZM?= =?utf-8?B?NlE9PQ==?= X-OriginatorOrg: cornelisnetworks.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33dc326f-0c99-4fb2-a4a4-08dbbb77ce0e X-MS-Exchange-CrossTenant-AuthSource: BL0PR01MB4131.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2023 14:25:44.0696 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4dbdb7da-74ee-4b45-8747-ef5ce5ebe68a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KR9gIQHsX7DgiC1sT44U1FY6hGWVffIeN1BLOKCv/XyQeGpGgoqQ9/ubSNIpfSMl/D0/eiawuae5NFLQoZfQjnqRXc67glTcsCRVGVF/duU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR01MB6943 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 22 Sep 2023 07:25:58 -0700 (PDT) On 9/22/2023 5:29 AM, Leon Romanovsky wrote: > > On Thu, 21 Sep 2023 07:17:47 +0000, Justin Stitt wrote: >> `strncpy` is deprecated for use on NUL-terminated destination strings >> [1] and as such we should prefer more robust and less ambiguous string >> interfaces. >> >> We see that `buf` is expected to be NUL-terminated based on it's use >> within a trace event wherein `is_misc_err_name` and `is_various_name` >> map to `is_name` through `is_table`: >> | TRACE_EVENT(hfi1_interrupt, >> | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_ent= ry, >> | int src), >> | TP_ARGS(dd, is_entry, src), >> | TP_STRUCT__entry(DD_DEV_ENTRY(dd) >> | __array(char, buf, 64) >> | __field(int, src) >> | ), >> | TP_fast_assign(DD_DEV_ASSIGN(dd); >> | is_entry->is_name(__entry->buf, 64, >> | src - is_entry->start); >> | __entry->src =3D src; >> | ), >> | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, >> | __entry->src) >> | ); >> >> [...] > > Applied, thanks! It is unfortunate that this and the qib patch was accepted so quickly. The= replacement is functionally correct. However, I was going to suggest usin= g strscpy() since the return value is never looked at and all use cases onl= y require a NUL-terminated string. Padding is not needed. > > [1/1] IB/hfi1: replace deprecated strncpy > https://git.kernel.org/rdma/rdma/c/c2d0c5b28a77d5 > > Best regards, External recipient