mirror of
https://passt.top/passt
synced 2025-06-09 17:15:34 +02:00
flow: Fix clang error (clang-analyzer-security.PointerSub)
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>
This commit is contained in:
parent
0f7bf10b0a
commit
2d3d69c5c3
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue