From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752205AbbBETtR (ORCPT ); Thu, 5 Feb 2015 14:49:17 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:49834 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbbBETtQ (ORCPT ); Thu, 5 Feb 2015 14:49:16 -0500 Date: Thu, 5 Feb 2015 19:49:14 +0000 From: Al Viro To: Steven Rostedt Cc: linux-kernel@vger.kernel.org Subject: [RFC][PATCHES] constifying ftrace globs Message-ID: <20150205194914.GR29656@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We don't really need to NUL-terminate the substring we are matching against; all it takes is introducing memmem(3) and using it instead of str[n]str(). It's not that much work - see vfs.git#ftrace_glob. The reason I went there is rather amusing; it all started with making do_execve() take arrays of const strings for argv and envp. After all, we never change them *and* we often enough pass arrays of string literals that way. It exploded into a series of 75 commits, with the final ripple being argv_split() and argv_free(). OK, turns out that ftrace is using those as well, fortunately it's done to get arrays of regexes, so it should be trivial to constify as well, right? Imagine the amount of swearing when I noticed that it *does* modify the resulting strings... This series deals with that problem, providing the missing prereq for the patchbomb from hell... Could you review #ftrace_glob? It's not large - seven commits, boiling down to include/linux/ftrace.h | 8 ++--- include/linux/string.h | 1 + kernel/trace/ftrace.c | 68 ++++++++++++++++++-------------------- kernel/trace/trace.h | 2 +- kernel/trace/trace_events_filter.c | 26 +++++++++------ lib/string.c | 34 ++++++++++++------- 6 files changed, 75 insertions(+), 64 deletions(-) Patches in followups.