summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <[email protected]>2025-02-17 13:54:01 +0100
committerMarc Mutz <[email protected]>2025-02-19 16:44:41 +0000
commit24a26ed3a3842398276ae54602e8e1936a2f2323 (patch)
treec976b7eccdf18824aa5fda6a5ebe9c41d106b95c
parent01fc6aeaff4a412bcda97a810586a7b8b48b923f (diff)
QBenchmarkPerfEvents: help Coverity understand the code
Coverity thinks that r may be negative and not -1 and warns that the cast to quint64 may overflow. Change the check for `== -1` to `< 0` to help Coverity (and other readers of the code) understand that this cannot happen. Amends c63420a117fe67107466d806890e901d091cb1d5. Pick-to: 6.9 6.8 6.5 6.2 5.15 Coverity-Id: 474172 Change-Id: I7615e0ef152e1e6e9cbc6dec1b8ecd4f8879521c Reviewed-by: Thiago Macieira <[email protected]>
-rw-r--r--src/testlib/qbenchmarkperfevents.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp
index 02f8e7af414..53607310f5a 100644
--- a/src/testlib/qbenchmarkperfevents.cpp
+++ b/src/testlib/qbenchmarkperfevents.cpp
@@ -546,7 +546,7 @@ static quint64 rawReadValue(int fd)
while (nread < sizeof results) {
char *ptr = reinterpret_cast<char *>(&results);
qint64 r = qt_safe_read(fd, ptr + nread, sizeof results - nread);
- if (r == -1) {
+ if (r < 0) {
perror("QBenchmarkPerfEventsMeasurer::readValue: reading the results");
exit(1);
}