Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2749007pxb; Mon, 31 Jan 2022 03:32:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwApD1fBASAhr1F6RZw0nrVCKBwbWjpNlsEOa9DhRjDx0dF+RDhFhcNbwt8OV/j3E1Vxho+ X-Received: by 2002:a63:82c7:: with SMTP id w190mr16152216pgd.531.1643628765969; Mon, 31 Jan 2022 03:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643628765; cv=none; d=google.com; s=arc-20160816; b=cU4op7g8ZZZmuuQ6nOSKTYAP/DjZPNEatIUhJj015rB5Ic6xNfhDeDsi08ESGHN96d Z2G1uLiOdJvtZ0jEE4qPlarAorpmE7npiWZQB2p/8IhoeHhufWSN3NzeIeeuCjIQyk/j Qu4AxrdnUn0EH0XVXK1mGVRa9fCIK5YCR6Kx7m+Hgq+yarDRIipSmObwvgGUrpvEuXrn lkv3TZDj+82AaKK3dkiZyrIb3E3wUU+Rb1DpOr6eBcaelnlXZ7VvCeryy1dvGU4BJVaJ 27bTSjkn1nxlOTloOv5ks3Q6DqxaithxCiJqWfD2i+MUHU9dwdlhMAp1OX7KtuvExKxw 5Lqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=oMn17WFmi8JoSbNYP1UK4HmRAR7xewhm8ji82xfqiak=; b=qnQm3FiO+U7TJHLMVvdBTkDTxNlVGPbjCs0H9StFYaJb/vdR3KuE0WdbnzdwzM+0ob 57uznkUOe6qlysCWqZ8VQwpDgozDXq4pic9VmSlRlfxoIO6MkQI3F/b4G64IbD6QyT4Y hgeI1PjnG2EYZ1F3e1bJYCyJ6MoJZ5/Jd6lxXiarMjArGuMxE+n5cYEABEQ60o7yb19b ubEkp0vCXKbU1qMXof2IfDdiLPktJ5C0drGOpSoHMbs83hEHrIBh5qsF2unrCZnND4gS vrvQDviw8urXEXwj00fALovHKgm+3sQi3DWrOEtffAdo9wA/98BZvXYoif6g5sTG8FVQ aT6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BBNDEXBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si13170518pfc.91.2022.01.31.03.32.34; Mon, 31 Jan 2022 03:32:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BBNDEXBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1351126AbiA1UIg (ORCPT + 99 others); Fri, 28 Jan 2022 15:08:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351109AbiA1UIf (ORCPT ); Fri, 28 Jan 2022 15:08:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B410C06173B for ; Fri, 28 Jan 2022 12:08:35 -0800 (PST) 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 C03B361DCA for ; Fri, 28 Jan 2022 20:08:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF54BC340EB; Fri, 28 Jan 2022 20:08:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1643400514; bh=4K4IWRbcZ254e2H50ie9lOC9n8GLTP1rVEIdNgWO43w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=BBNDEXBEQbf+6n9IWqTgisEvB+ZnZD6Wg5xB/iHrZ/YY1RNG2D0oRAfdykvviIHpq YG3+mXHvF9UkIjSQnAeA4niBiOGaxKdrad/ovigZHcM5+vOYKpWIZYTtdqWWtS9DES dITLbMTvY1V0PoAP1KRZYjY8hkVD7CV8bVkqTaA4Os/WaHp6+d55Od2SY9/IH00xS/ EIcRDHEpIzINwfRSan0oQdJ8L905xrTifieVT8HpEy2ofTv1UiQgl2T/3kSdC8/bKg XeLMVyYy9MqrOVTWBHhFZHxH/MrvdHemohbe/Lv5TQE+lsLAbLU1sqEvrQVd6+T+C+ BLCLgTlous+Kg== From: Tom Zanussi To: rostedt@goodmis.org Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, Tom Zanussi Subject: [PATCH v2 2/2] tracing: Remove size restriction on synthetic event cmd error logging Date: Fri, 28 Jan 2022 14:08:27 -0600 Message-Id: <0376692396a81d0b795127c66ea92ca5bf60f481.1643399022.git.zanussi@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, synthetic event command error strings are restricted to a length of MAX_FILTER_STR_VAL (256), which is too short for some commands already seen in the wild (with cmd strings longer than that showing up truncated in err_log). Remove the restriction so that no synthetic event command error string is ever truncated. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_synth.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c index 149011e34ad9..d3d9cd677f9a 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -42,10 +42,13 @@ enum { ERRORS }; static const char *err_text[] = { ERRORS }; -static char last_cmd[MAX_FILTER_STR_VAL]; +static char *last_cmd; static int errpos(const char *str) { + if (!str || !last_cmd) + return 0; + return err_pos(last_cmd, str); } @@ -54,11 +57,19 @@ static void last_cmd_set(const char *str) if (!str) return; - strncpy(last_cmd, str, MAX_FILTER_STR_VAL - 1); + kfree(last_cmd); + last_cmd = kzalloc(strlen(str) + 1, GFP_KERNEL); + if (!last_cmd) + return; + + strncpy(last_cmd, str, strlen(str) + 1); } -static void synth_err(u8 err_type, u8 err_pos) +static void synth_err(u8 err_type, u16 err_pos) { + if (!last_cmd) + return; + tracing_log_err(NULL, "synthetic_events", last_cmd, err_text, err_type, err_pos); } -- 2.17.1