summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2021-11-18 10:41:21 -0800
committerKalle Valo <kvalo@codeaurora.org>2021-11-29 12:44:55 +0200
commit642a57475b30213ebac1f7061eaf4d0415d9c5a1 (patch)
tree5ad723126b60363489b4ca29c6f710aded72f5b6 /drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
parent5fd32ae0433a7af37eac27ace3aabae8cb7c2fc4 (diff)
downloadlinux-stable-642a57475b30213ebac1f7061eaf4d0415d9c5a1.tar.gz
linux-stable-642a57475b30213ebac1f7061eaf4d0415d9c5a1.tar.bz2
linux-stable-642a57475b30213ebac1f7061eaf4d0415d9c5a1.zip
libertas_tf: Use struct_group() for memcpy() region
In preparation for FORTIFY_SOURCE performing compile-time and run-time field array bounds checking for memcpy(), memmove(), and memset(), avoid intentionally writing across neighboring fields. Use struct_group() in struct txpd around members tx_dest_addr_high and tx_dest_addr_low so they can be referenced together. This will allow memcpy() and sizeof() to more easily reason about sizes, improve readability, and avoid future warnings about writing beyond the end of tx_dest_addr_high. "pahole" shows no size nor member offset changes to struct txpd. "objdump -d" shows no object code changes. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20211118184121.1283821-1-keescook@chromium.org
Diffstat (limited to 'drivers/net/wireless/marvell/libertas_tf/libertas_tf.h')
-rw-r--r--drivers/net/wireless/marvell/libertas_tf/libertas_tf.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h b/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
index 5d726545d987..b2af2ddb6bc4 100644
--- a/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
+++ b/drivers/net/wireless/marvell/libertas_tf/libertas_tf.h
@@ -268,10 +268,12 @@ struct txpd {
__le32 tx_packet_location;
/* Tx packet length */
__le16 tx_packet_length;
- /* First 2 byte of destination MAC address */
- u8 tx_dest_addr_high[2];
- /* Last 4 byte of destination MAC address */
- u8 tx_dest_addr_low[4];
+ struct_group(tx_dest_addr,
+ /* First 2 byte of destination MAC address */
+ u8 tx_dest_addr_high[2];
+ /* Last 4 byte of destination MAC address */
+ u8 tx_dest_addr_low[4];
+ );
/* Pkt Priority */
u8 priority;
/* Pkt Trasnit Power control */