diff options
author | Laurent Vivier <lvivier@redhat.com> | 2025-05-13 11:41:02 +0200 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2025-05-14 17:51:37 +0200 |
commit | 2d3d69c5c348d18112596bd3fdeed95689c613c8 (patch) | |
tree | 7a0ad02ccd143f507401b0439105ae723fdc73d9 | |
parent | 0f7bf10b0a5542690dc6c75e4b56a6030ca8a663 (diff) | |
download | passt-2d3d69c5c348d18112596bd3fdeed95689c613c8.tar passt-2d3d69c5c348d18112596bd3fdeed95689c613c8.tar.gz passt-2d3d69c5c348d18112596bd3fdeed95689c613c8.tar.bz2 passt-2d3d69c5c348d18112596bd3fdeed95689c613c8.tar.lz passt-2d3d69c5c348d18112596bd3fdeed95689c613c8.tar.xz passt-2d3d69c5c348d18112596bd3fdeed95689c613c8.tar.zst passt-2d3d69c5c348d18112596bd3fdeed95689c613c8.zip |
Fixes the following clang-analyzer warning:
flow_table.h:96:25: note: Subtraction of two pointers that do not point into the same array is undefined behavior
96 | return (union flow *)f - flowtab;
The `flow_idx()` function is called via `FLOW_IDX()` from
`flow_foreach_slot()`, where `f` is set to `&flowtab[idx].f`.
Therefore, `f` and `flowtab` do point to the same array.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rw-r--r-- | flow_table.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/flow_table.h b/flow_table.h index 2d5c65c..3f3f4b7 100644 --- a/flow_table.h +++ b/flow_table.h @@ -93,6 +93,7 @@ extern union flow flowtab[]; */ static inline unsigned flow_idx(const struct flow_common *f) { + /* NOLINTNEXTLINE(clang-analyzer-security.PointerSub) */ return (union flow *)f - flowtab; } |