Commit 6b12e0a
rtnetlink: do_setlink: Use struct sockaddr_storage
Instead of a heap allocating a variably sized struct sockaddr and lying
about the type in the call to netif_set_mac_address(), use a stack
allocated struct sockaddr_storage. This lets us drop the cast and avoid
the allocation.
Putting "ss" on the stack means it will get a reused stack slot since
it is the same size (128B) as other existing single-scope stack variables,
like the vfinfo array (128B), so no additional stack space is used by
this function.
Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Kees Cook <kees@kernel.org>
Link: https://patch.msgid.link/20250521204619.2301870-7-kees@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>1 parent 9ca6804 commit 6b12e0a
1 file changed
Lines changed: 4 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3080 | 3080 | | |
3081 | 3081 | | |
3082 | 3082 | | |
3083 | | - | |
3084 | | - | |
3085 | | - | |
3086 | | - | |
3087 | | - | |
3088 | | - | |
3089 | | - | |
3090 | | - | |
3091 | | - | |
3092 | | - | |
3093 | | - | |
| 3083 | + | |
3094 | 3084 | | |
3095 | 3085 | | |
3096 | 3086 | | |
3097 | 3087 | | |
3098 | 3088 | | |
3099 | 3089 | | |
3100 | 3090 | | |
3101 | | - | |
3102 | | - | |
3103 | | - | |
3104 | | - | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
3105 | 3094 | | |
3106 | 3095 | | |
3107 | 3096 | | |
| |||
0 commit comments