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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211207091843.0765fa3f@gandalf.local.home>
Date:   Tue, 7 Dec 2021 09:18:43 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Qing Wang <wangqing@...o.com>
Cc:     Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] trace: use WARN instead of printk and WARN_ON

On Tue,  7 Dec 2021 04:55:32 -0800
Qing Wang <wangqing@...o.com> wrote:

> From: Wang Qing <wangqing@...o.com>
> 
> Simply use WARN instead of printk(KERN_WARNING, ...) and WARN_ON.
> 
> Signed-off-by: Wang Qing <wangqing@...o.com>
> ---
>  kernel/trace/trace_output.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index 3547e71..e0348ec
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -775,8 +775,7 @@ int register_trace_event(struct trace_event *event)
>  		list_add_tail(&event->list, list);
>  
>  	} else if (event->type > __TRACE_LAST_TYPE) {
> -		printk(KERN_WARNING "Need to add type to trace.h\n");
> -		WARN_ON(1);
> +		WARN(1, "Need to add type to trace.h\n");

If you are going to fix this, then please fix it properly.

	} else if (WARN(event->type > __TRACE_LAST_TYPE,
			"Need to add type to trace.h")) {

>  		goto out;
>  	} else {
>  		/* Is this event already used */
> @@ -1569,11 +1568,9 @@ __init static int init_events(void)
>  		event = events[i];
>  
>  		ret = register_trace_event(event);
> -		if (!ret) {
> -			printk(KERN_WARNING "event %d failed to register\n",
> -			       event->type);
> -			WARN_ON_ONCE(1);
> -		}
> +		if (!ret)
> +			WARN_ONCE(1, "event %d failed to register\n",
> +				  event->type);

And this should just turn into:

		WARN_ONCE(!ret, "event %d failed to register", event->type);

-- Steve


>  	}
>  
>  	return 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ