git: be8e341777c0 - stable/13 - bwi: Fix clang 14 warning about possible unaligned access

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 16 Feb 2022 20:25:57 UTC
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=be8e341777c0e560c4db1cfb576f75ab8a041c31

commit be8e341777c0e560c4db1cfb576f75ab8a041c31
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-02-07 20:59:46 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-02-16 20:24:53 +0000

    bwi: Fix clang 14 warning about possible unaligned access
    
    On architectures with strict alignment requirements (e.g. arm), clang 14
    warns about a packed struct which encloses a non-packed union:
    
    In file included from sys/dev/bwi/bwimac.c:79:
    sys/dev/bwi/if_bwivar.h:308:7: error: field iv_val within 'struct bwi_fw_iv' is less aligned than 'union (unnamed union at sys/dev/bwi/if_bwivar.h:305:2)' and is usually due to 'struct bwi_fw_iv' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]
            }                       iv_val;
                                    ^
    
    It appears to help if you also add __packed to the inner union (i.e.
    iv_val). No change to the layout is intended.
    
    MFC after:      3 days
    Differential Revision: https://reviews.freebsd.org/D34196
    
    (cherry picked from commit 09d0a0fbe859e3fc7bbff0cf48c389b5e55b9e00)
---
 sys/dev/bwi/if_bwivar.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/bwi/if_bwivar.h b/sys/dev/bwi/if_bwivar.h
index 90b4aeab6d26..9961cfca9193 100644
--- a/sys/dev/bwi/if_bwivar.h
+++ b/sys/dev/bwi/if_bwivar.h
@@ -305,7 +305,7 @@ struct bwi_fw_iv {
 	union {
 		uint32_t	val32;
 		uint16_t	val16;
-	} 			iv_val;
+	} __packed		iv_val;
 } __packed;
 
 #define BWI_FW_IV_OFS_MASK	__BITS(14, 0)