lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <34afd8ffbb1c889e91fa536cf60369a697d86575.camel@redhat.com>
Date: Wed, 08 Oct 2025 16:55:52 -0500
From: Crystal Wood <crwood@...hat.com>
To: Costa Shulyupin <costa.shul@...hat.com>, Steven Rostedt
	 <rostedt@...dmis.org>, Tomas Glozar <tglozar@...hat.com>, John Kacur
	 <jkacur@...hat.com>, Jan Stancek <jstancek@...hat.com>, Tiezhu Yang
	 <yangtiezhu@...ngson.cn>, linux-trace-kernel@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/5] tools/rtla: Add fatal() and replace error
 handling pattern

On Wed, 2025-10-08 at 22:59 +0300, Costa Shulyupin wrote:
> The code contains some technical debt in error handling,
> which complicates the consolidation of duplicated code.
> 
> Introduce an fatal() function to replace the common pattern of
> err_msg() followed by exit(EXIT_FAILURE), reducing the length of an
> already long function.
> 
> Further patches using fatal() follow.
> 
> Signed-off-by: Costa Shulyupin <costa.shul@...hat.com>
> ---
>  tools/tracing/rtla/src/osnoise_hist.c  | 42 ++++++++--------------
>  tools/tracing/rtla/src/osnoise_top.c   | 42 ++++++++--------------
>  tools/tracing/rtla/src/timerlat_hist.c | 50 +++++++++-----------------
>  tools/tracing/rtla/src/timerlat_top.c  | 48 +++++++++----------------
>  tools/tracing/rtla/src/timerlat_u.c    | 12 +++----
>  tools/tracing/rtla/src/utils.c         | 14 ++++++++
>  tools/tracing/rtla/src/utils.h         |  1 +
>  7 files changed, 80 insertions(+), 129 deletions(-)
> 
> diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c
> index dffb6d0a98d7..43c323521f55 100644
> --- a/tools/tracing/rtla/src/osnoise_hist.c
> +++ b/tools/tracing/rtla/src/osnoise_hist.c
> @@ -592,10 +592,8 @@ static struct common_params
>  			break;
>  		case 'e':
>  			tevent = trace_event_alloc(optarg);
> -			if (!tevent) {
> -				err_msg("Error alloc trace event");
> -				exit(EXIT_FAILURE);
> -			}
> +			if (!tevent)
> +				fatal("Error alloc trace event");
>  
>  			if (params->common.events)
>  				tevent->next = params->common.events;
> @@ -615,10 +613,8 @@ static struct common_params
>  		case 'H':
>  			params->common.hk_cpus = 1;
>  			retval = parse_cpu_set(optarg, &params->common.hk_cpu_set);
> -			if (retval) {
> -				err_msg("Error parsing house keeping CPUs\n");
> -				exit(EXIT_FAILURE);
> -			}
> +			if (retval)
> +				fatal("Error parsing house keeping CPUs\n");

Looks like there was existing inconsistency with newlines... maybe have
fatal() include the newline automatically to simplify callers slightly?
We're not going to print a continuation if we're exiting.

Otherwise, for the whole series:
Reviewed-by: Crystal Wood <crwood@...hat.com>

-Crystal


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ