lkml.org 
[lkml]   [2022]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] rtla/osnoise: fix NULL but dereferenced coccicheck errors
From

Hi Daniel,

On 2022/3/31 20:25, Daniel Bristot de Oliveira wrote:
> Hi Wan
>
> On 3/22/22 12:32, Wan Jiabing wrote:
>> Fix the following coccicheck errors:
>> ./tools/tracing/rtla/src/osnoise_hist.c:870:31-36: ERROR: record is NULL but dereferenced.
>> ./tools/tracing/rtla/src/osnoise_top.c:650:31-36: ERROR: record is NULL but dereferenced.
>>
>> "record" is NULL before calling osnoise_init_trace_tool.
>> Add a tag "out_free" to avoid dereferring a NULL pointer.
> Yes, I see the problem.
>
> Please, change the Subject to something with better information about the
> problem, instead of the way you fund it.
OK, I'll fix it.

>> Fixes: 51d64c3a1819 ("rtla: Add -e/--event support")
>> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
>> ---
>> tools/tracing/rtla/src/osnoise_hist.c | 5 +++--
>> tools/tracing/rtla/src/osnoise_top.c | 9 +++++----
>> 2 files changed, 8 insertions(+), 6 deletions(-)
> Please, also add the version of coccicheck you are using, because it seems that
> there is a problem with it. There is a similar problem with timerlat, added by
> the same patch, but it seems that coccicheck did not find it.
>
> Would you mind to check coccicheck, and also add the fix for timerlat?

Yes,  I used null/deref_null.cocci to report these warnings. But there
were no warnings in
timerlat. So I check the null/deref_null.cocci and modify some rules.

Using modified null/deref_null.cocci, there are warnings as follow:

tools/tracing/rtla/src/timerlat_hist.c:905:31-36: ERROR: record is NULL
but dereferenced.
tools/tracing/rtla/src/osnoise_top.c:650:31-36: ERROR: record is NULL
but dereferenced.
tools/tracing/rtla/src/osnoise_hist.c:870:31-36: ERROR: record is NULL
but dereferenced.
tools/tracing/rtla/src/timerlat_top.c:700:31-36: ERROR: record is NULL
but dereferenced.

I'll resend the patch and fix them all.

Thanks,
Wan Jiabing
> Thanks.
> -- Daniel
>

\
 
 \ /
  Last update: 2022-04-01 04:05    [W:0.060 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site