Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp92396imu; Wed, 19 Dec 2018 14:16:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/WVsxFgrCT64BAP3BNkbTOrMK92X2T57SxYnB8e/vbdVqM+KPZGRvB+En9jE103krZAOYg7 X-Received: by 2002:a62:1212:: with SMTP id a18mr22779975pfj.217.1545257760796; Wed, 19 Dec 2018 14:16:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545257760; cv=none; d=google.com; s=arc-20160816; b=of4GpM069IGXf7RKiHpl1Os+9B95LSV0NC8vvD8E88cyoHp5c6XMjDguMN4MNWjFWE Gm8mnfro2C0CkAiS+LQE0IfoS/pOMcogyFzvuUftTxzKrqdSaJOTLMxJM8sJ1pudehDj cDHEJouLZfU/VrgTPGhzobfMScZECRzneZucg1tJ/g/0UCfi9M/Ws7lrNEbyN2WTyUI8 mCZ3WPvahvVzlM7I+6QlKn4GkHMiGIKWIW6gjNJqmuZGBSCqczza/STdcTSSLn0X+RqV wVjefuvpdU+AqtOiZ5JZJApk+ynP2AIrOs3E+9HX7YUHXV2C+fqM0Yd0rL45UEj02XmM GNDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=XFufhZnHm5WHyAz7krqL3SinPkbJfX6mEj8vF4WyfmA=; b=k9D+ACtbcWDWNyhIXJHxRMoeUSlVGXXFDkHLVILYy94bzL6GCm+pDnfVJZ7+jyc12v TjFK2jibhZ6xT+UAMDcP1W4tiACQ1SFSgniiwtnD+sD3SUdcjZ4i05PomGx0R1prdnMi WyOIQL0xzW46/sA5V/GDdw+BMgXDToA1GeSUuiBGQp18Za3AAfIB62NZqgRGqGNmzY0M e6zKODuPzegKgXpHKHfR2Gv7bLp6Z6qHuk88ytb9GAha+Y6+ThSd0EMNitKH2atXBxMs rfh9/h8/R9Qv8rYgfSkWxYeMYqpy1Ast1OjYYpRgcakIJn8Rw6V7+6DjJ9Xyl8SsorwK 6mfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si16764550pld.398.2018.12.19.14.15.45; Wed, 19 Dec 2018 14:16:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730383AbeLSVIZ (ORCPT + 99 others); Wed, 19 Dec 2018 16:08:25 -0500 Received: from smtprelay0197.hostedemail.com ([216.40.44.197]:43412 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727852AbeLSVIZ (ORCPT ); Wed, 19 Dec 2018 16:08:25 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay02.hostedemail.com (Postfix) with ESMTP id DDBA41E2555; Wed, 19 Dec 2018 21:08:23 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::,RULES_HIT:41:355:379:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2553:2559:2562:2691:2828:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4385:5007:6119:7903:10004:10400:10848:10967:11232:11658:11914:12740:12760:12895:13069:13161:13229:13255:13311:13357:13439:14181:14659:14721:14777:21080:21433:21451:21627:21819:30012:30022:30054:30070:30083:30090:30091,0,RBL:47.151.153.53:@perches.com:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:27,LUA_SUMMARY:none X-HE-Tag: name68_66256ac3c132d X-Filterd-Recvd-Size: 3052 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA; Wed, 19 Dec 2018 21:08:21 +0000 (UTC) Message-ID: <0c78a59b1dcb05237f35bb9c9714debfa96680c7.camel@perches.com> Subject: Re: [PATCH 2/7] tracing: Change strlen to sizeof for hist trigger static strings From: Joe Perches To: Steven Rostedt , Tom Zanussi Cc: tglx@linutronix.de, mhiramat@kernel.org, namhyung@kernel.org, vedang.patel@intel.com, bigeasy@linutronix.de, joel@joelfernandes.org, mathieu.desnoyers@efficios.com, julia@ni.com, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org Date: Wed, 19 Dec 2018 13:08:20 -0800 In-Reply-To: <20181219160138.447a4bb0@gandalf.local.home> References: <20181219144047.49fabfa6@gandalf.local.home> <1545248809.2396.2.camel@kernel.org> <20181219153002.62ede7e9@gandalf.local.home> <1545251919.4161.4.camel@kernel.org> <20181219160138.447a4bb0@gandalf.local.home> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-12-19 at 16:01 -0500, Steven Rostedt wrote: > On Wed, 19 Dec 2018 14:38:39 -0600 > Tom Zanussi wrote: > > > On Wed, 2018-12-19 at 15:30 -0500, Steven Rostedt wrote: > > > On Wed, 19 Dec 2018 12:20:19 -0800 > > > Joe Perches wrote: > > > > > > > > Yeah, I had considered it but wasn't sure it was worth it. Since > > > > > you're suggesting it is, I can send another patch on top of > > > > > these, or > > > > > feel free if you want to too. ;-) > > > > > > > > I believe the 'strlen("foo") -> sizeof("foo") - 1' > > > > conversions do not change objects at all. > > > > > > > > strlen("constant") is already optimized by gcc to a > > > > constant value when fed a constant string. > > > > > > If that's the case (and it probably is), then yeah, strlen is > > > probably > > > better. As it can handle the "not a constant" that you stated in > > > another email. > > > > > > > OK, so I guess that means we should just drop this patch ('[PATCH 2/7] > > tracing: Change strlen to sizeof for hist trigger static strings'). > > > > No, that patch is fine, the macro was not. I've already applied your > patch set. Just need to run it through my tests. The patch included: - start += strlen("char["); + start += sizeof("char[") - 1; So, that 2/7 patch is unnecessary as there is no object code change and using 'sizeof("const") - 1' is less intelligible than strlen("const") If you convert the strncmp(ptr, "const", strlen("const")) uses to strncmp_prefix(ptr, "const") eventually, the patch just makes more variations to change.