Skip to content

Commit ab3f782

Browse files
keeskuba-moo
authored andcommitted
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>
1 parent 5c624a1 commit ab3f782

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
@@ -2309,7 +2309,7 @@ static struct sw_flow_actions *nla_alloc_flow_actions(int size)
23092309

23102310
WARN_ON_ONCE(size > MAX_ACTIONS_BUFSIZE);
23112311

2312-
sfa = kmalloc(sizeof(*sfa) + size, GFP_KERNEL);
2312+
sfa = kmalloc(kmalloc_size_roundup(sizeof(*sfa) + size), GFP_KERNEL);
23132313
if (!sfa)
23142314
return ERR_PTR(-ENOMEM);
23152315

0 commit comments

Comments
 (0)