Change in ...osmo-trx[master]: trxd_fill_common(): fix TRXD header version coding

fixeria gerrit-no-reply at lists.osmocom.org
Sat Jul 20 07:22:42 UTC 2019


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/14845


Change subject: trxd_fill_common(): fix TRXD header version coding
......................................................................

trxd_fill_common(): fix TRXD header version coding

The expression "version && 0x07" is wrong because it performs a
Boolean operation on a constant other than 0 or 1. We actually
need a binary AND here. Also, version field is 4 bit long, so
the mask 0x07 == 0b111 should actually be 0b1111.

Change-Id: I290931559ce01cf6e43470b18855c46808d6c2a5
Fixes: CID#202038 Integer handling issues
---
M Transceiver52M/proto_trxd.c
1 file changed, 1 insertion(+), 1 deletion(-)



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

diff --git a/Transceiver52M/proto_trxd.c b/Transceiver52M/proto_trxd.c
index fff23da..fbef77a 100644
--- a/Transceiver52M/proto_trxd.c
+++ b/Transceiver52M/proto_trxd.c
@@ -27,7 +27,7 @@
 
 static void trxd_fill_common(struct trxd_hdr_common *common, const struct trx_ul_burst_ind *bi, uint8_t version)
 {
-	common->version = version && 0x07;
+	common->version = version & 0b1111;
 	common->reserved = 0;
 	common->tn = bi->tn;
 	osmo_store32be(bi->fn, &common->fn);

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14845
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I290931559ce01cf6e43470b18855c46808d6c2a5
Gerrit-Change-Number: 14845
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190720/69b2d62e/attachment-0001.html>


More information about the gerrit-log mailing list