net: switchdev: add reminder near struct switchdev_notifier_fdb_info
Subsystems (3)
PATCH 1/1 net: switchdev: add reminder near struct switchdev_notifier_fdb_info
br_switchdev_fdb_notify() creates an on-stack FDB info variable, and initializes it member by member. As such, newly added fields which are not initialized by br_switchdev_fdb_notify() will contain junk bytes from the stack.
Other uses of struct switchdev_notifier_fdb_info have a struct initializer which should put zeroes in the uninitialized fields.
Add a reminder above the structure for future developers. Recently discussed during review.
--- include/net/switchdev.h | 3 +++ 1 file changed, 3 insertions(+)
include/net/switchdev.h +3 -0
@@ -239,6 +239,9 @@ struct switchdev_notifier_info {const void *ctx; }; +/* Remember to update br_switchdev_fdb_populate() when adding +* new members to this structure +*/ struct switchdev_notifier_fdb_info {struct switchdev_notifier_info info;/* must be first */ const unsigned char *addr;
Signature · 1 line
2.25.1
Quoted 8 lines · Vladimir Oltean
br_switchdev_fdb_notify()creates an on-stack FDB info variable, and initializes it member by member. As such, newly added fields which are not initialized bybr_switchdev_fdb_notify()will contain junk bytes from the stack.Other uses of struct
switchdev_notifier_fdb_infohave a struct initializer which should put zeroes in the uninitialized fields.
Quoted 6 lines
Add a reminder above the structure for future developers. Recently discussed during review.
Quoted 23 lines · Vladimir Oltean
br_switchdev_fdb_notify()creates an on-stack FDB info variable, and initializes it member by member. As such, newly added fields which are not initialized bybr_switchdev_fdb_notify()will contain junk bytes from the stack.Other uses of struct
switchdev_notifier_fdb_infohave a struct initializer which should put zeroes in the uninitialized fields.Add a reminder above the structure for future developers. Recently discussed during review.
Signed-off-by Vladimir Oltean <[email protected]>--- include/net/switchdev.h | 3 +++ 1 file changed, 3 insertions(+)include/net/switchdev.h +0
-0
include/net/switchdev.h struct switchdev_notifier_info { · line 247
Quoted 9 lines
include/net/switchdev.h +3
-0@@ -239,6 +239,9 @@ struct switchdev_notifier_info {const void *ctx; }; +/* Remember to update br_switchdev_fdb_populate() when adding +* new members to this structure +*/ struct switchdev_notifier_fdb_info {struct switchdev_notifier_info info;/* must be first */ const unsigned char *addr;
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Tue, 28 Jun 2022 13:08:31 +0300 you wrote:
br_switchdev_fdb_notify()creates an on-stack FDB info variable, and initializes it member by member. As such, newly added fields which are not initialized bybr_switchdev_fdb_notify()will contain junk bytes from the stack.Other uses of struct
switchdev_notifier_fdb_infohave a struct initializer which should put zeroes in the uninitialized fields.[...]
Here is the summary with links:
- [net-next] net: switchdev: add reminder near struct switchdev_notifier_fdb_info
https://git.kernel.org/netdev/net-next/c/3eb4a4c3442c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html