On Mon, Oct 26, 2026 at 15:30:21 +0100, Michal Privoznik wrote:
From: Michal Privoznik <mprivozn@redhat.com>
The aim of VIR_MULTIPLY_ADD_IS_OVERFLOW() macro is to check whether a multiplication and subsequent addition would overflow over given limit. For instance, if value * multiply + add would fit into say unsigned long. But because of the way the macro is written, a compiler warning may be thrown if 'add' is zero, i.e. we want to check just if value * multiply would overflow.
Rewrite the offending part of the macro to make if work even in that case.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/internal.h | 2 +- tests/utiltest.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>