aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-03-29 15:08:04 +0200
committerneels <nhofmeyr@sysmocom.de>2021-04-08 21:12:49 +0000
commit711ac95c26a9c7f280a3fa82ddae5e2442038c45 (patch)
treedecd100e91c5d0db4d701144267f65072fea2428
parent2fbdc7c5de9ec56223bcba57026fb9c3eadf21ca (diff)
fixup for neighbor config for coverity
Check against NULL pointers to allow only resolving local or only remote neighbors in resolve_neighbors(). (Though no caller exists currently that would need this feature, it is trivial and more future-safe.) Related: CID#220459 CID#220460 Change-Id: I8c2046335ec6f8a5d6b757446c98d8e630ee015f
-rw-r--r--src/osmo-bsc/neighbor_ident.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/osmo-bsc/neighbor_ident.c b/src/osmo-bsc/neighbor_ident.c
index 263d410ac..6e706258d 100644
--- a/src/osmo-bsc/neighbor_ident.c
+++ b/src/osmo-bsc/neighbor_ident.c
@@ -130,8 +130,10 @@ int resolve_neighbors(struct gsm_bts **local_neighbor_p, struct gsm0808_cell_id_
struct gsm_bts *local_neighbor = NULL;
struct gsm0808_cell_id_list2 remotes = {};
- *local_neighbor_p = NULL;
- *remote_neighbors = (struct gsm0808_cell_id_list2){ 0 };
+ if (local_neighbor_p)
+ *local_neighbor_p = NULL;
+ if (remote_neighbors)
+ *remote_neighbors = (struct gsm0808_cell_id_list2){ 0 };
llist_for_each_entry(n, &from_bts->neighbors, entry) {
struct gsm_bts *neigh_bts;