aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2022-05-06 11:16:05 +0200
committerlaforge <laforge@osmocom.org>2022-05-07 19:21:00 +0000
commit52b910ebbdbeca5a423bdeb5bfa08a74f253ce23 (patch)
treee6648357136b8e7e9914dfec53d9d388dba4ee2a
parenta09d78faa97b087e8a17cf29484caf4ffbc27b9e (diff)
bts.c: prevent signed integer overflow in depends_on code
bts.c:818:37: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Change-Id: Ic68e6eb11fb70bf68d3f075fe2e467aedcbfaba8
-rw-r--r--src/osmo-bsc/bts.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c
index 57868333b..df8d93d5d 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -798,7 +798,7 @@ void bts_depend_mark(struct gsm_bts *bts, int dep)
int idx, bit;
depends_calc_index_bit(dep, &idx, &bit);
- bts->depends_on[idx] |= 1 << bit;
+ bts->depends_on[idx] |= 1U << bit;
}
void bts_depend_clear(struct gsm_bts *bts, int dep)
@@ -806,7 +806,7 @@ void bts_depend_clear(struct gsm_bts *bts, int dep)
int idx, bit;
depends_calc_index_bit(dep, &idx, &bit);
- bts->depends_on[idx] &= ~(1 << bit);
+ bts->depends_on[idx] &= ~(1U << bit);
}
int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other)
@@ -815,7 +815,7 @@ int bts_depend_is_depedency(struct gsm_bts *base, struct gsm_bts *other)
depends_calc_index_bit(other->nr, &idx, &bit);
/* Check if there is a depends bit */
- return (base->depends_on[idx] & (1 << bit)) > 0;
+ return (base->depends_on[idx] & (1U << bit)) > 0;
}
static int bts_is_online(struct gsm_bts *bts)