* dim_calc_stats() may cause uninitialized values to be used
@ 2021-12-01 19:40 Tony Battersby
2021-12-02 15:08 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Tony Battersby @ 2021-12-01 19:40 UTC (permalink / raw)
To: Tal Gilboa, netdev
I am reporting the following possible logic bug:
lib/dim/dim.c::dim_calc_stats() doesn't set curr_stats if delta_us == 0,
which would result in using uninitialized values in net_dim_decision()
and rdma_dim_decision().
I don't know anything about this code. I encountered this only as a
compiler warning compiling an out-of-tree module that had a copy of
dim_calc_stats() inlined for compatibility with old kernels, and I
decided to investigate and report. There is no compiler warning in
mainline since dim_calc_stats() and net_dim() are in separate C files so
the compiler can't fully analyze it, but it looks like mainline has the
problem also, if the delta_us == 0 condition is possible.
Tony Battersby
Cybernetics
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: dim_calc_stats() may cause uninitialized values to be used
2021-12-01 19:40 dim_calc_stats() may cause uninitialized values to be used Tony Battersby
@ 2021-12-02 15:08 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2021-12-02 15:08 UTC (permalink / raw)
To: Tony Battersby, Tal Gilboa; +Cc: netdev
On Wed, Dec 01, 2021 at 02:40:47PM -0500, Tony Battersby wrote:
> I am reporting the following possible logic bug:
>
> lib/dim/dim.c::dim_calc_stats() doesn't set curr_stats if delta_us == 0,
> which would result in using uninitialized values in net_dim_decision()
> and rdma_dim_decision().
>
> I don't know anything about this code. I encountered this only as a
> compiler warning compiling an out-of-tree module that had a copy of
> dim_calc_stats() inlined for compatibility with old kernels, and I
> decided to investigate and report. There is no compiler warning in
> mainline since dim_calc_stats() and net_dim() are in separate C files so
> the compiler can't fully analyze it, but it looks like mainline has the
> problem also, if the delta_us == 0 condition is possible.
IMHO, it is false alarm, I don't see how delta_us can be 0. I would remove
this if (!delta_us) check.
Tal?
Thanks
>
> Tony Battersby
> Cybernetics
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-02 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-01 19:40 dim_calc_stats() may cause uninitialized values to be used Tony Battersby
2021-12-02 15:08 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).