valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0780-journal-verify-add-comment-and-silence-LGTM-warning.patch

661545
From d58e871a424fedf286747816e9525fc2287bb72d Mon Sep 17 00:00:00 2001
661545
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
661545
Date: Tue, 2 Oct 2018 12:26:23 +0200
661545
Subject: [PATCH] journal-verify: add comment and silence LGTM warning
661545
661545
(cherry picked from commit 0a587335d2a16a48479b10969491a7353d78c25b)
661545
661545
Resolves: #1694605
661545
---
661545
 src/journal/journal-verify.c | 7 ++++---
661545
 1 file changed, 4 insertions(+), 3 deletions(-)
661545
661545
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
661545
index 250d4c7586..7c6d8ab780 100644
661545
--- a/src/journal/journal-verify.c
661545
+++ b/src/journal/journal-verify.c
661545
@@ -70,10 +70,11 @@ static void draw_progress(uint64_t p, usec_t *last_usec) {
661545
 }
661545
 
661545
 static uint64_t scale_progress(uint64_t scale, uint64_t p, uint64_t m) {
661545
+        /* Calculates scale * p / m, but handles m == 0 safely, and saturates.
661545
+         * Currently all callers use m >= 1, but we keep the check to be defensive.
661545
+         */
661545
 
661545
-        /* Calculates scale * p / m, but handles m == 0 safely, and saturates */
661545
-
661545
-        if (p >= m || m == 0)
661545
+        if (p >= m || m == 0) // lgtm[cpp/constant-comparison]
661545
                 return scale;
661545
 
661545
         return scale * p / m;