Skip to content

Commit

Permalink
dpif-netlink: Fix incorrect bit shift in compat mode.
Browse files Browse the repository at this point in the history
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior in
 lib/dpif-netlink.c:1077:40: runtime error:
   left shift of 1 by 31 places cannot be represented in type 'int'

     #0  0x73fc31 in dpif_netlink_port_add_compat lib/dpif-netlink.c:1077:40
     #1  0x73fc31 in dpif_netlink_port_add lib/dpif-netlink.c:1132:17
     #2  0x2c1745 in dpif_port_add lib/dpif.c:597:13
     #3  0x07b279 in port_add ofproto/ofproto-dpif.c:3957:17
     #4  0x01b209 in ofproto_port_add ofproto/ofproto.c:2124:13
     #5  0xfdbfce in iface_do_create vswitchd/bridge.c:2066:13
     #6  0xfdbfce in iface_create vswitchd/bridge.c:2109:13
     #7  0xfdbfce in bridge_add_ports__ vswitchd/bridge.c:1173:21
     #8  0xfb5319 in bridge_add_ports vswitchd/bridge.c:1189:5
     #9  0xfb5319 in bridge_reconfigure vswitchd/bridge.c:901:9
     #10 0xfae0f9 in bridge_run vswitchd/bridge.c:3334:9
     #11 0xfe67dd in main vswitchd/ovs-vswitchd.c:129:9
     #12 0x4b6d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
     #13 0x4b6e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
     #14 0x562594eed024 in _start (vswitchd/ovs-vswitchd+0x787024)

Fixes: 526df7d ("tunnel: Provide framework for tunnel extensions for VXLAN-GBP and others")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
igsilya committed Aug 4, 2022
1 parent 91b41af commit 01edbc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dpif-netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ dpif_netlink_port_add_compat(struct dpif_netlink *dpif, struct netdev *netdev,

ext_ofs = nl_msg_start_nested(&options, OVS_TUNNEL_ATTR_EXTENSION);
for (i = 0; i < 32; i++) {
if (tnl_cfg->exts & (1 << i)) {
if (tnl_cfg->exts & (UINT32_C(1) << i)) {
nl_msg_put_flag(&options, i);
}
}
Expand Down

0 comments on commit 01edbc3

Please sign in to comment.