When assigning the length to the `struct sock_fprog` object, we calculate it by multiplying the number of `struct sock_filter` objects, `j`, by `sizeof(struct sock_filter)` and then dividing by `sizeof(bsf[0])`, which, since `bsf[0]` is a `struct sock_filter`, is equal to `sizeof(struct sock_filter)`. Remove the `sizeof` expressions and just assign `j`. Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx> --- src/conntrack/bsf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conntrack/bsf.c b/src/conntrack/bsf.c index 589bfd8e5d18..35cc8b7690c0 100644 --- a/src/conntrack/bsf.c +++ b/src/conntrack/bsf.c @@ -783,7 +783,7 @@ int __setup_netlink_socket_filter(int fd, struct nfct_filter *f) show_filter(bsf, from, j, "---- final verdict ----"); from = j; - sf.len = (sizeof(struct sock_filter) * j) / sizeof(bsf[0]); + sf.len = j; sf.filter = bsf; return setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, &sf, sizeof(sf)); -- 2.35.1