The GCC would report that the queue might be uninitialized,
rearrange the code slightly to avoid this error:
In function ‘add_ovs_qos_table_entry’,
inlined from ‘configure_qos’ at controller/binding.c:419:17,
inlined from ‘update_qos’ at controller/binding.c:458:17:
controller/binding.c:324:5: error: ‘queue’ may be used uninitialized
[-Werror=maybe-uninitialized]
324 | ovsrec_queue_set_external_ids(queue, &external_ids);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
controller/binding.c: In function ‘update_qos’:
controller/binding.c:299:26: note: ‘queue’ was declared here
299 | struct ovsrec_queue *queue;
| ^~~~~
Fixes: 7d1d111ff213 ("controller: configure qos through ovs qos table and do
not run tc directly")
Signed-off-by: Ales Musil <[email protected]>
---
controller/binding.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/controller/binding.c b/controller/binding.c
index 634edaa4e..eb9524142 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -296,18 +296,17 @@ add_ovs_qos_table_entry(struct ovsdb_idl_txn *ovs_idl_txn,
smap_clear(&external_ids);
}
- struct ovsrec_queue *queue;
- size_t i;
- for (i = 0; i < qos->n_queues; i++) {
- queue = qos->value_queues[i];
-
- const char *p = smap_get(&queue->external_ids, "ovn_port");
+ struct ovsrec_queue *queue = NULL;
+ for (size_t i = 0; i < qos->n_queues; i++) {
+ const char *p =
+ smap_get(&qos->value_queues[i]->external_ids, "ovn_port");
if (p && !strcmp(p, ovn_port)) {
+ queue = qos->value_queues[i];
break;
}
}
- if (i == qos->n_queues) {
+ if (!queue) {
queue = ovsrec_queue_insert(ovs_idl_txn);
ovsrec_qos_update_queues_setkey(qos, queue_id, queue);
}
--
2.52.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev