Skip to content

Commit 0b18164

Browse files
committed
openvswitch: Use kmalloc_size_roundup() to match ksize() usage
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2163374 Upstream Status: linux.git commit ab3f782 Author: Kees Cook <keescook@chromium.org> Date: Tue Oct 18 02:06:33 2022 -0700 openvswitch: Use kmalloc_size_roundup() to match ksize() usage Round up allocations with kmalloc_size_roundup() so that openvswitch's use of ksize() is always accurate and no special handling of the memory is needed by KASAN, UBSAN_BOUNDS, nor FORTIFY_SOURCE. Cc: Pravin B Shelar <pshelar@ovn.org> Cc: dev@openvswitch.org Signed-off-by: Kees Cook <keescook@chromium.org> Link: https://lore.kernel.org/r/20221018090628.never.537-kees@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent f86b7a4 commit 0b18164

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/openvswitch/flow_netlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2280,7 +2280,7 @@ static struct sw_flow_actions *nla_alloc_flow_actions(int size)
22802280

22812281
WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE);
22822282

2283-
sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL);
2283+
sfa = kmalloc(kmalloc_size_roundup(sizeof(*sfa) + size), GFP_KERNEL);
22842284
if (!sfa)
22852285
return ERR_PTR(-ENOMEM);
22862286

0 commit comments

Comments
 (0)