Change in pysim[master]: ts_51_011: fix bitmask compositing in EF_xPLMNwAcT.enc_act()

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Sun Mar 7 20:53:16 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/23264 )


Change subject: ts_51_011: fix bitmask compositing in EF_xPLMNwAcT.enc_act()
......................................................................

ts_51_011: fix bitmask compositing in EF_xPLMNwAcT.enc_act()

This commit fixes two problems (found by semgrep):

  * "'foo' and 'bar' in list" is incorrect, because it's interpreted
    as "'foo' and ('bar' in list)".  Strings with a non-zero length
    evaluate to True, thus it's True if at least 'bar' is present.

  * Copy-pasted 'E-UTRAN NB-S1' checked two times.

The first condition is redundant, and the whole block can be
re-implemented using two independent 'if' statements.

Change-Id: Iceb66160cfb571db8879d3810c55d252c763d320
---
M pySim/ts_51_011.py
1 file changed, 4 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/64/23264/1

diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py
index 03d74ad..e4a26a3 100644
--- a/pySim/ts_51_011.py
+++ b/pySim/ts_51_011.py
@@ -527,12 +527,10 @@
         if 'cdma2000 1xRTT' in in_list:
             u16 |= 0x0010
         # E-UTRAN
-        if 'E-UTRAN WB-S1' and 'E-UTRAN NB-S1' in in_list:
-            u16 |= 0x7000   # WB-S1 and NB-S1
-        elif 'E-UTRAN NB-S1' in in_list:
-            u16 |= 0x6000   # only WB-S1
-        elif 'E-UTRAN NB-S1' in in_list:
-            u16 |= 0x5000   # only NB-S1
+        if 'E-UTRAN WB-S1' in in_list:
+            u16 |= 0x6000
+        if 'E-UTRAN NB-S1' in in_list:
+            u16 |= 0x5000
         # GSM mess
         if 'GSM' in in_list and 'EC-GSM-IoT' in in_list:
             u16 |= 0x008C

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Iceb66160cfb571db8879d3810c55d252c763d320
Gerrit-Change-Number: 23264
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210307/3fab075b/attachment.htm>


More information about the gerrit-log mailing list