[PATCH] osmo-trx[master]: sigProcLib: Fix negative value check on unsigned value

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Tom Tsou gerrit-no-reply at lists.osmocom.org
Thu Mar 23 21:58:16 UTC 2017


Review at  https://gerrit.osmocom.org/2163

sigProcLib: Fix negative value check on unsigned value

Convert negative value check on unsigned value to zero check
to avoid potential divide-by-zero error condition.

Coverity issue CID 165059: Control flow issues (NO_EFFECT)
Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257
---
M Transceiver52M/sigProcLib.cpp
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/63/2163/1

diff --git a/Transceiver52M/sigProcLib.cpp b/Transceiver52M/sigProcLib.cpp
index 6f50f04..6111d5a 100644
--- a/Transceiver52M/sigProcLib.cpp
+++ b/Transceiver52M/sigProcLib.cpp
@@ -1712,7 +1712,7 @@
 
   signalVector::const_iterator windowItr = rxBurst.begin(); //+rxBurst.size()/2 - 5*windowLength/2;
   float energy = 0.0;
-  if (windowLength < 0) windowLength = 20;
+  if (windowLength == 0) return 0.0;
   if (windowLength > rxBurst.size()) windowLength = rxBurst.size();
   for (unsigned i = 0; i < windowLength; i++) {
     energy += windowItr->norm2();

-- 
To view, visit https://gerrit.osmocom.org/2163
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <tom at tsou.cc>



More information about the gerrit-log mailing list