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>] [day] [month] [year] [list]
Message-ID: <SL2PR06MB3082DACA51DD4E6EA9400996BD6F9@SL2PR06MB3082.apcprd06.prod.outlook.com>
Date:   Wed, 8 Dec 2021 08:11:58 +0000
From:   王擎 <wangqing@...o.com>
To:     Steven Rostedt <rostedt@...dmis.org>
CC:     Ingo Molnar <mingo@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] trace: use WARN instead of printk and WARN_ON


>> 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.

Is there any problem with this modification?

>
>       } 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);

Yes,this should be right.

Thanks,
Qing

>-- Steve
>
>
>>        }
>>  
>>        return 0;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ