Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2601905rdb; Fri, 22 Sep 2023 03:38:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGZ2fw3oDwxI3WsdbTNrSf794j1KWNck6nD1pkHaGNd/WgVnrxQKf5l5lcpbhqufQQJKhox X-Received: by 2002:a05:6830:1315:b0:6b9:8feb:8337 with SMTP id p21-20020a056830131500b006b98feb8337mr7667608otq.9.1695379136251; Fri, 22 Sep 2023 03:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695379136; cv=none; d=google.com; s=arc-20160816; b=i9O56hoiACSo0ELdJav7GDE6RvpJp9GV7JsRxalDkVWqebAWbpV1wrj0Ztr/F4tpnF 0WOHGXZfCAJEt7/PFa52K3p5ZLHdNxEhPwOPnfLvyNF25Sq76Hf0gaAa+uWT6m4FvLUV Spasc5UYxqcBWIoFQQY0kk2jPNNJ6zCZ5N5AY7xgql5FPgxSS3W9OrAm3KH7InTOrbxm 96s5BnE8hPdAX+2jCOoM8DHCM93LBNAeYTxipLGSQJKUhrBTQ59GXxiShr81obChZWGY Zvs9XjGm5nMM4wDrcdboDm4+4J+nHpjVSflyvx76hZb1P+VnkhvU96jekVnl6Bbpuc/W 0JLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:date :message-id:subject:references:in-reply-to:cc:to:from:dkim-signature; bh=h8M5C8lXc4tKLwoxWyYeHbq/u31hpGF25P4gSdOsyoM=; fh=jad6pKPAr8rcspTx/XO+pmFUfIFME7p0XiJ+08wl1BM=; b=S/AHNbFpAFLx3kjk4/QX+t2Ns/rvWhh46JgOK6H7q5SsTvQDD+1+BQYF5f4obP0hx6 D+9nUJy1yIvelRxqXUE1Qte3mBePi1F09llxBY6aTJjCb89voYx2PtaPy9bmB4kXAPqg /vchCCrNs0cv91cXT6ybhxfiZ9YPLpoHB5VW3C0G0+IWwDOxZTXJQORuCawNqoDqE1Ip y75ekPfMQTb5086GlTMhBQv27uVknNWNVRzQqI4+C4x0MOCAz3d+9PUeGATbSYpN1wNU rnu8UWoXZ/ul2FfHhV/uXP2sABhkfpPh7BZ0uxo4RGiOzI+sSTi9ZvG9j9crb8qKoSgK vO1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hgFltriU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id by6-20020a056a00400600b0068fc2f7cef3si3420663pfb.358.2023.09.22.03.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:38:56 -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=@kernel.org header.s=k20201202 header.b=hgFltriU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 547C1837E676; Fri, 22 Sep 2023 03:30:08 -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 S233209AbjIVKaB (ORCPT + 99 others); Fri, 22 Sep 2023 06:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232913AbjIVK35 (ORCPT ); Fri, 22 Sep 2023 06:29:57 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA9A8A9; Fri, 22 Sep 2023 03:29:51 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1433C433C8; Fri, 22 Sep 2023 10:29:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695378591; bh=/P01kWffyQ8DbfOXIhAgApHORmbtWN/NPbQ6cSR4bi8=; h=From:To:Cc:In-Reply-To:References:Subject:Date:From; b=hgFltriUPn/ceU5dzTFyJydqBjVdasnTmTxIroX7UPxu5vvxgO3doApo8NvmC9C5k d+mFrguR3NSQm0NkCbopQkvW6bWdWYLHAmtel9agIOWW3BuyAliIRZmlUajkPp6u47 w09m+AAcu2BKzo2ixklRM+D1Aj70tLjQjbrb1ogfqlMB8+qHhTrcA5AbYA5wWGldDn GpT3m1/jznQuqGHPxGQbXAFwVBpPpFHvQhJ92fiFMFmUDzZz7sGf3j6ocTXnC+nItw X8RgXSawVwupXc3mmFNHZmpqN0ph7RAREwr2dtIv1nUH4y8OG/daacqwM7T5OlzLiy 8ZjSZHl+AsyDw== From: Leon Romanovsky To: Dennis Dalessandro , Jason Gunthorpe , Justin Stitt Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org In-Reply-To: =?utf-8?q?=3C20230921-strncpy-drivers-infiniband-hw-hfi1-chip-c?= =?utf-8?q?-v1-1-37afcf4964d9=40google=2Ecom=3E?= References: =?utf-8?q?=3C20230921-strncpy-drivers-infiniband-hw-hfi1-chip-c-?= =?utf-8?q?v1-1-37afcf4964d9=40google=2Ecom=3E?= Subject: Re: [PATCH] IB/hfi1: replace deprecated strncpy Message-Id: <169537858725.3339131.15264681410291677148.b4-ty@kernel.org> Date: Fri, 22 Sep 2023 13:29:47 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: b4 0.12-dev-a055d X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 03:30:10 -0700 (PDT) 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_entry, > | 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 = src; > | ), > | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, > | __entry->src) > | ); > > [...] Applied, thanks! [1/1] IB/hfi1: replace deprecated strncpy https://git.kernel.org/rdma/rdma/c/c2d0c5b28a77d5 Best regards, -- Leon Romanovsky