batman-adv: post-fixes cleanup
Sven Eckelmann
maintainercover batman-adv: post-fixes cleanup
In some of the recent fixes, we got a couple of unclean changes which are either reported by the daily builds or were noticed during the "follow up fixes" preparations.
It is nothing spectacular and no reason to add it to the stable branch. Let us just handle them as part of main/next.
---
Sven Eckelmann (2):
batman-adv: add missing includes
batman-adv: tt: replace open-coded overflow check with helper
net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/fragmentation.c | 1 + net/batman-adv/gateway_client.c | 1 + net/batman-adv/hard-interface.c | 1 + net/batman-adv/tp_meter.c | 1 + net/batman-adv/translation-table.c | 8 +++----- net/batman-adv/tvlv.c | 1 + 7 files changed, 9 insertions(+), 5 deletions(-)
---
base-commit: 3158b1f3ce2a4fe0a07d2a9544dd4b72e2f2670f
change-id: 20260503-post-fixes-cleanup-f5be3530755d
Best regards,
Signature · 1 line
Sven Eckelmann <[email protected]>
Sven Eckelmann
maintainerPATCH 1/2 batman-adv: add missing includes
Some of the recent fixes required features from new header files. There is currently build problem because transitive includes take care of it. But the batman-adv source code tries to avoid the dependency to transitive/implicite includes because it has no control over them and they might get removed at some point.
--- net/batman-adv/bat_v_ogm.c | 1 + net/batman-adv/fragmentation.c | 1 + net/batman-adv/gateway_client.c | 1 + net/batman-adv/hard-interface.c | 1 + net/batman-adv/tp_meter.c | 1 + net/batman-adv/translation-table.c | 1 + net/batman-adv/tvlv.c | 1 + 7 files changed, 7 insertions(+)
net/batman-adv/bat_v_ogm.c +1 -0
@@ -8,6 +8,7 @@#include "main.h" #include <linux/atomic.h> +#include <linux/bug.h> #include <linux/byteorder/generic.h> #include <linux/container_of.h> #include <linux/errno.h>
net/batman-adv/fragmentation.c +1 -0
@@ -8,6 +8,7 @@#include "main.h" #include <linux/atomic.h> +#include <linux/bug.h> #include <linux/byteorder/generic.h> #include <linux/errno.h> #include <linux/etherdevice.h>
net/batman-adv/gateway_client.c +1 -0
@@ -8,6 +8,7 @@#include "main.h" #include <linux/atomic.h> +#include <linux/bug.h> #include <linux/byteorder/generic.h> #include <linux/container_of.h> #include <linux/err.h>
net/batman-adv/hard-interface.c +1 -0
@@ -8,6 +8,7 @@#include "main.h" #include <linux/atomic.h> +#include <linux/bug.h> #include <linux/byteorder/generic.h> #include <linux/compiler.h> #include <linux/container_of.h>
net/batman-adv/tp_meter.c +1 -0
@@ -8,6 +8,7 @@#include "main.h" #include <linux/atomic.h> +#include <linux/bug.h> #include <linux/build_bug.h> #include <linux/byteorder/generic.h> #include <linux/cache.h>
net/batman-adv/translation-table.c +1 -0
@@ -9,6 +9,7 @@#include <linux/atomic.h> #include <linux/bitops.h> +#include <linux/bug.h> #include <linux/build_bug.h> #include <linux/byteorder/generic.h> #include <linux/cache.h>
net/batman-adv/tvlv.c +1 -0
@@ -6,6 +6,7 @@#include "main.h" +#include <linux/bug.h> #include <linux/byteorder/generic.h> #include <linux/container_of.h> #include <linux/etherdevice.h>
Signature · 1 line
2.47.3
Sven Eckelmann
maintainerPATCH 2/2 batman-adv: tt: replace open-coded overflow check with helper
In reply to Sven EckelmannThe commit 6043a632dd06 ("batman-adv: reject oversized global TT response buffers") introduced an open-coded check to ensure that the allocated buffer size can be stored in a u16. The check_add_overflow() helper can perform the addition and overflow check in one step, so use that instead.
--- net/batman-adv/translation-table.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
net/batman-adv/translation-table.c +2 -5
@@ -840,9 +840,9 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,u16 num_vlan =0 ;u16 num_entries =0 ;u16 tvlv_len =0 ; -unsigned int change_offset;struct batadv_tvlv_tt_vlan_data *tt_vlan;struct batadv_orig_node_vlan *vlan; +size_t change_offset;u8 *tt_change_ptr;spin_lock_bh (&orig_node->vlan_list_lock);
@@ -857,14 +857,11 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,if (*tt_len <0 ) *tt_len =batadv_tt_len (num_entries); -if (change_offset >U16_MAX || *tt_len >U16_MAX - change_offset) { +if (check_add_overflow (*tt_len, change_offset, &tvlv_len)) { *tt_len =0 ; goto out; } - tvlv_len = *tt_len; - tvlv_len += change_offset; - *tt_data =kmalloc (tvlv_len,GFP_ATOMIC );if (!*tt_data) { *tt_len =0 ;
Signature · 1 line
2.47.3
Re: [PATCH batadv-next 2/2] batman-adv: tt: replace open-coded overflow check with helper
Quoted 6 lines · Sven Eckelmann
The commit
6043a632dd06("batman-adv: reject oversized global TT response buffers") introduced an open-coded check to ensure that the allocated buffer size can be stored in a u16. Thecheck_add_overflow()helper can perform the addition and overflow check in one step, so use that instead.Signed-off-by Sven Eckelmann <[email protected]>
Signature · 1 line
Antonio Quartulli