For some reason gcc 14.1.1 from Fedora 41 thinks that the variable
may end up not initialized:
ofproto/ofproto-dpif-xlate.c: In function 'compose_sample_action':
ofproto/ofproto-dpif-xlate.c:3465:40:
error: 'observe_offset' may be used uninitialized
3465 | ctx->xout->last_observe_offset = observe_offset;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
ofproto/ofproto-dpif-xlate.c:3418:12:
note: 'observe_offset' was declared here
3418 | size_t observe_offset;
| ^~~~~~~~~~~~~~
We have an assertion in the code to ensure that at least one of
the actions is present (userspace or psample), so the variable
should actually be always initialized.
Initialize explicitly just to silence the warning.
Fixes: 516569d31fbf ("ofproto: xlate: Make sampled drops explicit.")
Signed-off-by: Ilya Maximets <[email protected]>
---
ofproto/ofproto-dpif-xlate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 02567a961..850597b3a 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -3423,8 +3423,8 @@ compose_sample_action(struct xlate_ctx *ctx,
* insert a meter action before the user space action. */
struct ofproto *ofproto = &ctx->xin->ofproto->up;
uint32_t meter_id = ofproto->slowpath_meter_id;
+ size_t observe_offset = UINT32_MAX;
size_t cookie_offset = 0;
- size_t observe_offset;
/* The meter action is only used to throttle userspace actions.
* If they are not needed and the sampling rate is 100%, avoid generating
--
2.45.2
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev