Skip to content

Commit

Permalink
src/stats.c: fix double assignment to stats->min
Browse files Browse the repository at this point in the history
Fixes defect reported by coverity:
| CID 1475713 (#1 of 1): Unused value (UNUSED_VALUE)
| assigned_value: Assigning value 1.79769e+308 to stats->min here, but that stored value is overwritten before it can be used.

This also fixes 'min' calculation as 'min' was already set to the
smalles possible value and thus could not be decreased.

Signed-off-by: Enrico Joerns <[email protected]>
  • Loading branch information
ejoerns committed Mar 17, 2022
1 parent a6cf37f commit 43d2f80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void r_stats_init(struct RaucStats *stats)
memset(stats, 0, sizeof(*stats));

stats->min = G_MAXDOUBLE;
stats->min = G_MINDOUBLE;
stats->max = G_MINDOUBLE;
}

void r_stats_add(struct RaucStats *stats, gdouble value)
Expand Down

0 comments on commit 43d2f80

Please sign in to comment.