Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3477125imw; Mon, 11 Jul 2022 09:19:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sVuudk8fqEbgDSs+1tD6W28O/c5nWRevssuBslyycZktJB3KK3lBy7w5uIap98Nj9ikwbF X-Received: by 2002:a63:ea58:0:b0:40d:fb08:5796 with SMTP id l24-20020a63ea58000000b0040dfb085796mr16583618pgk.320.1657556384211; Mon, 11 Jul 2022 09:19:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657556384; cv=none; d=google.com; s=arc-20160816; b=r7VGge2Yr2ja+BFE/eAK9QeIsHYNMGM5hjEVWMrAcdBcR+69PLM1wW/9pyEUd1YY+Q 1GooqpFaH21xyXKGHI9NJa6YKDtkXkFe04MToGON7WTYn1zXu+rK19sBTh4zSVFtbHWl tFkUzq6LRwCTKANWmPphMdNm2RzmBbPfEI1Ts15pt2dn1e2CgieDzpVQHZHciQ/6dn+8 hqlZIhgVb0GlOkc5gnHB/NkQI7t4OhYZT7GabwAyebqgdddVwrCkdlODOsRiQG8LiERf GhwIjJ0xxd7QEBgyYtyuj7B9uCjbzadvH83Ik7bboM44Dil1JBCsh5IwXhteUn49xsV/ WzIQ== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=E+DdzqL1Xq27/wXDTl9r3RwKuqSTwNQhIYC1RiIFO7E=; b=FUx9acrzMDNb8yMg10CPy5Bk+apuB7WZqYU2Stkou99VJw/ll7r5NQ+nI+nLCIVnSY 7kOwLBAK+yKams7IlSmEkrQrDGcQ+qFNkuDN/BoM8nTpPTwshGoeiXVl2eJVcwOJaIDY bUiwBUtg/vfX4rtAoi12lnmvgaBJsEVyqYuvXGyqZwwOxXOUeIuIt1mW8j6u7lt9upbz 0NsvoAXLXwyy88ESHZlLkMhn56gtd/5k6tux6XD7RuZNVcu/n0bQuilhowFJcy/sEts/ IonF6MrjDY1ZIociLzypIx6hp9d42Jx4lg4LjDw/71ZOuTJPsdTOBpWQxo4k/Kr0ED9u 8C0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a056a0008d200b0051e756bec27si12233775pfu.146.2022.07.11.09.19.32; Mon, 11 Jul 2022 09:19:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231698AbiGKQK0 (ORCPT + 99 others); Mon, 11 Jul 2022 12:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231868AbiGKQKT (ORCPT ); Mon, 11 Jul 2022 12:10:19 -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 405097AB15 for ; Mon, 11 Jul 2022 09:10:18 -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 C08AC611C2 for ; Mon, 11 Jul 2022 16:10:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C238CC34115; Mon, 11 Jul 2022 16:10:16 +0000 (UTC) Date: Mon, 11 Jul 2022 12:10:14 -0400 From: Steven Rostedt To: "XueBing Chen" Cc: mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: use strscpy to replace strlcpy Message-ID: <20220711121014.6f9e75cb@gandalf.local.home> In-Reply-To: <20220711104125.1d9ba146@gandalf.local.home> References: <49ec0969.e32.181eda74871.Coremail.chenxuebing@jari.cn> <20220711104125.1d9ba146@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,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-kernel@vger.kernel.org On Mon, 11 Jul 2022 10:41:25 -0400 Steven Rostedt wrote: > On Mon, 11 Jul 2022 22:26:12 +0800 (GMT+08:00) > "XueBing Chen" wrote: > > > The strlcpy should not be used because it doesn't limit the source > > length. Preferred is strscpy. > > That's not enough justification to make the switch. > > These calls are done at boot up. If there's a bug in the source, I rather > have it crash. And unless there is good justification and understanding of how the code works, blindly switching strlcpy() with strscpy() can have undesirable consequences: https://lore.kernel.org/all/20220701094403.3044-1-adrian.hunter@intel.com/T/#u Please stop changing all strlcpy() to strscpy() unless there's good justification to do so. Just saying "strscpy() is preferred", is not justification to make the change. -- Steve