Skip to content

Commit

Permalink
ovs build: Fix memset with zero size warning.
Browse files Browse the repository at this point in the history
In file included from /usr/include/string.h:640:0,
                 from ./lib/string.h:20,
                 from /usr/include/netinet/icmp6.h:22,
                 from ../lib/flow.h:21,
                 from ../lib/flow.c:18:
In function 'memset',
    inlined from 'flow_push_vlan_uninit' at ../lib/flow.c:2188:19:
/usr/include/x86_64-linux-gnu/bits/string3.h:81:30: error:
call to '__warn_memset_zero_len' declared with attribute warning:
memset used with constant zero length parameter; this could be
due to transposed parameters [-Werror]
       __warn_memset_zero_len ();
                              ^
cc1: all warnings being treated as errors
make[2]: *** [lib/flow.lo] Error 1

Fixes: f0fb825 ("Add support for 802.1ad (QinQ tunneling)")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
darball1 authored and blp committed Apr 15, 2017
1 parent 88cbc2d commit 6b6b508
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/flow.c
Expand Up @@ -2222,7 +2222,9 @@ flow_push_vlan_uninit(struct flow *flow, struct flow_wildcards *wc)
{
if (wc) {
int n = flow_count_vlan_headers(flow);
memset(wc->masks.vlans, 0xff, sizeof(union flow_vlan_hdr) * n);
if (n) {
memset(wc->masks.vlans, 0xff, sizeof(union flow_vlan_hdr) * n);
}
}
memmove(&flow->vlans[1], &flow->vlans[0],
sizeof(union flow_vlan_hdr) * (FLOW_MAX_VLAN_HEADERS - 1));
Expand Down

0 comments on commit 6b6b508

Please sign in to comment.