From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62BC3C433DF for ; Mon, 12 Oct 2020 21:43:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F13D420797 for ; Mon, 12 Oct 2020 21:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730397AbgJLVmp (ORCPT ); Mon, 12 Oct 2020 17:42:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:49908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726780AbgJLVmo (ORCPT ); Mon, 12 Oct 2020 17:42:44 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 59C442073A; Mon, 12 Oct 2020 21:42:43 +0000 (UTC) Date: Mon, 12 Oct 2020 17:42:40 -0400 From: Steven Rostedt To: Tom Zanussi Cc: axelrasmussen@google.com, mhiramat@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/7] tracing: Add synthetic event error logging Message-ID: <20201012174240.7715df28@oasis.local.home> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Oct 2020 15:18:06 -0500 Tom Zanussi wrote: > +static char last_cmd[MAX_FILTER_STR_VAL]; > + > +static int errpos(const char *str) > +{ > + return err_pos(last_cmd, str); > +} > + > +static void last_cmd_set(char *str) > +{ > + if (!str) > + return; > + > + strncat(last_cmd, str, MAX_FILTER_STR_VAL - 1); If I understand strncat() correctly, it will add 'n' + 1 bytes from str to last_cmd. That is, I think you want: strncat(last_cmd, str, MAX_FILTER_STR_VAL - (strlen(last_cmd) + 1)); -- Steve > +} > + > +static void synth_err(u8 err_type, u8 err_pos) > +{ > + tracing_log_err(NULL, "synthetic_events", last_cmd, err_text, > + err_type, err_pos); > +} > + > +static void synth_err_clear(void) > +{ > + last_cmd[0] = '\0'; > +} > +