]> Git Repo - J-linux.git/commitdiff
wifi: mt76: Annotate struct mt76_rx_tid with __counted_by
authorKees Cook <[email protected]>
Fri, 15 Sep 2023 20:06:12 +0000 (13:06 -0700)
committerFelix Fietkau <[email protected]>
Sat, 30 Sep 2023 18:19:43 +0000 (20:19 +0200)
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
(for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct mt76_rx_tid.

[1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci

Cc: Felix Fietkau <[email protected]>
Cc: Lorenzo Bianconi <[email protected]>
Cc: Ryder Lee <[email protected]>
Cc: Shayne Chen <[email protected]>
Cc: Sean Wang <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: AngeloGioacchino Del Regno <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Kees Cook <[email protected]>
Reviewed-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
drivers/net/wireless/mediatek/mt76/mt76.h

index 3730c5e7d7026b64f3288ad3f305fde014117114..ea828ba0b83acf1509e9505714e4046ec89c96b6 100644 (file)
@@ -379,7 +379,7 @@ struct mt76_rx_tid {
 
        u8 started:1, stopped:1, timer_pending:1;
 
-       struct sk_buff *reorder_buf[];
+       struct sk_buff *reorder_buf[] __counted_by(size);
 };
 
 #define MT_TX_CB_DMA_DONE              BIT(0)
This page took 0.070997 seconds and 4 git commands to generate.