[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
Mon Mar 27 22:15:43 UTC 2017


Hello Neels Hofmeyr, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/2163

to look at the new patch set (#2).

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.

Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257
Fixes: Coverity CID 165059
---
M Transceiver52M/sigProcLib.cpp
1 file changed, 1 insertion(+), 1 deletion(-)


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

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: newpatchset
Gerrit-Change-Id: Ib0d7d1bceb5fe66e69345db93a74e3e0773a2257
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou <tom at tsou.cc>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list