Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1871907rwd; Mon, 15 May 2023 04:25:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KZaXBScwriScQYf2o4XvjjLSYAf62qYna+teF9ZjGGifkfjsQqx5nZNGquxs4Frypevr2 X-Received: by 2002:a17:903:41c2:b0:1a9:498a:1da2 with SMTP id u2-20020a17090341c200b001a9498a1da2mr41749837ple.56.1684149933554; Mon, 15 May 2023 04:25:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684149933; cv=none; d=google.com; s=arc-20160816; b=H3pc7O2rUCY6Gptg5SU9MqUKKW6nakI5Ybv4G9VY7pdkF5y3vvUzOhXK/5/nhS/Kxe X//MHvoc7r4i1q7hGwkAPqJ33JMEEa4q2GtjATEQts94Q+EmUbwLsjukMVzTJy+HygCw 8AfG0+nM6+nbWHCFzsKDxy0aA14m7Vheon8431N8mgTfVbjyHsjaIG5JkOtGlXOVSYYh ef4elroTbUoDwIxHir6FfM1sr1eJPAF9I9NazVUPmeZeD3VjqG3Vi7+blz1JqZvr1Qsd +O0ns5HulQpGJ7TbicsWbDlL6EReWDimiCprgMyVvR5JHCY2Zn4MHTvjxf3KLBL6sYeF EoWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=8s9q4NTxNxkzd+6p7DmXHZ/X6XDAcHtzYc0IRf5Ikek=; b=KsXK0Wt0NI9ODirVZS2345DLOY4h7tSAZ0NN34wQs8Dx6Us+7PaDqFSh2yF9pYao9t QgNTpK4CC//rujMK0ULfVkxq/3I6nG/KMg8MECSdf8NA7EMkvq8GHn2y3XsMRhUTVBlX Hy9NDnMIKsytHdWaTSS8TiIZr3NoMRzQdMWZjYhGWbqFIBc0XkT1fzBxBzG8fBTF8N6r NuPtX76xpvZ1TBTO+H1XHAFFFRF+kGaAJ+Wz5sxYYfJLev6AbIfxoiR32cRUc711DN2j SFOTYOJbdDdpiAFEUvTw7bd4G57sY2XLeJ86TsISBxfohk5XcVNqBvGkSOSH6JCIF1mU eiEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=essTLvsZ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a170902f54800b001aaf607910fsi17219002plf.376.2023.05.15.04.25.12; Mon, 15 May 2023 04:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=essTLvsZ; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240747AbjEOLVa (ORCPT + 99 others); Mon, 15 May 2023 07:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241238AbjEOLVW (ORCPT ); Mon, 15 May 2023 07:21:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88899189; Mon, 15 May 2023 04:21:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7A1A622A2; Mon, 15 May 2023 11:21:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A29F6C433EF; Mon, 15 May 2023 11:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684149676; bh=i8R4ZHlQNtjYj8yfNoBTP4YCAmQ9Q1y7fL64MkEt668=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=essTLvsZbf+9I99/Sz/ANCYPD1SvFqzuHuxe4Bp+km8E47gAhoPQgmE4NYTXsDByS 2+Cy9XvSVERsN8iXM/NHeFXPxMiYzx0GHItjVreqyd/1dymaxMeEzlBLaYrg2m/pZ9 B3Ja09Sb34qOMEg4uPOWDAof7ZJC0PXNLYlJb0STfrA3Hjep/nWKdljpFx3jPTftJZ paowHtVBgw6rUL07k9y2UCKIFWLWVd3vmbOaV3f6+H0Q8yN1i5AF+NddWKtMNf+x41 D+B/OaNIhiP7Nc0SamjltMMsIcw0ZwbED5aBixk0LQ10pOqO9DLv7YKSsaTdD354xf aAJbrfwmPV0Tg== Message-ID: <338aa895e02c795329c980cee67463faef0fc57e.camel@kernel.org> Subject: Re: [PATCH v3] NFSD: Remove open coding of string copy From: Jeff Layton To: Azeem Shaikh , Chuck Lever Cc: linux-hardening@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 15 May 2023 07:21:14 -0400 In-Reply-To: <20230515024044.2677124-1-azeemshaikh38@gmail.com> References: <20230515024044.2677124-1-azeemshaikh38@gmail.com> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.1 (3.48.1-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Mon, 2023-05-15 at 02:40 +0000, Azeem Shaikh wrote: > Instead of open coding a __dynamic_array(), use the __string() and > __assign_str() helper macros that exist for this kind of use case. >=20 > Part of an effort to remove deprecated strlcpy() [1] completely from the > kernel[2]. >=20 > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcp= y > [2] https://github.com/KSPP/linux/issues/89 >=20 > Fixes: 3c92fba557c6 ("NFSD: Enhance the nfsd_cb_setup tracepoint") > Signed-off-by: Azeem Shaikh > --- > fs/nfsd/trace.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/fs/nfsd/trace.h b/fs/nfsd/trace.h > index 4183819ea082..72a906a053dc 100644 > --- a/fs/nfsd/trace.h > +++ b/fs/nfsd/trace.h > @@ -1365,19 +1365,19 @@ TRACE_EVENT(nfsd_cb_setup, > __field(u32, cl_id) > __field(unsigned long, authflavor) > __sockaddr(addr, clp->cl_cb_conn.cb_addrlen) > - __array(unsigned char, netid, 8) > + __string(netid, netid) > ), > TP_fast_assign( > __entry->cl_boot =3D clp->cl_clientid.cl_boot; > __entry->cl_id =3D clp->cl_clientid.cl_id; > - strlcpy(__entry->netid, netid, sizeof(__entry->netid)); > + __assign_str(netid, netid); > __entry->authflavor =3D authflavor; > __assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr, > clp->cl_cb_conn.cb_addrlen) > ), > TP_printk("addr=3D%pISpc client %08x:%08x proto=3D%s flavor=3D%s", > __get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, > - __entry->netid, show_nfsd_authflavor(__entry->authflavor)) > + __get_str(netid), show_nfsd_authflavor(__entry->authflavor)) > ); > =20 > TRACE_EVENT(nfsd_cb_setup_err, Reviewed-by: Jeff Layton