[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240609045419.240265-2-mailhol.vincent@wanadoo.fr>
Date: Sun, 9 Jun 2024 13:54:18 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: Marc Kleine-Budde <mkl@...gutronix.de>,
linux-can@...r.kernel.org
Cc: Thomas Kopp <thomas.kopp@...rochip.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
"Gustavo A . R . Silva" <gustavoars@...nel.org>,
netdev@...r.kernel.org,
linux-hardening@...r.kernel.org,
Vincent Mailhol <mailhol.vincent@...adoo.fr>,
Kees Cook <kees@...nel.org>
Subject: [PATCH 1/2] can: peak_canfd: decorate pciefd_board.can with __counted_by()
A new __counted_by() attribute was introduced in [1]. It makes the
compiler's sanitizer aware of the actual size of a flexible array
member, allowing for additional runtime checks.
Move the end of line comments to the previous line to make room and
apply the __counted_by() attribute to the can flexible array member of
struct pciefd_board.
[1] commit dd06e72e68bc ("Compiler Attributes: Add __counted_by macro")
Link: https://git.kernel.org/torvalds/c/dd06e72e68bc
CC: Kees Cook <kees@...nel.org>
Signed-off-by: Vincent Mailhol <mailhol.vincent@...adoo.fr>
---
drivers/net/can/peak_canfd/peak_pciefd_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/peak_canfd/peak_pciefd_main.c b/drivers/net/can/peak_canfd/peak_pciefd_main.c
index 1df3c4b54f03..636102103a88 100644
--- a/drivers/net/can/peak_canfd/peak_pciefd_main.c
+++ b/drivers/net/can/peak_canfd/peak_pciefd_main.c
@@ -190,8 +190,10 @@ struct pciefd_board {
void __iomem *reg_base;
struct pci_dev *pci_dev;
int can_count;
- spinlock_t cmd_lock; /* 64-bits cmds must be atomic */
- struct pciefd_can *can[]; /* array of network devices */
+ /* 64-bits cmds must be atomic */
+ spinlock_t cmd_lock;
+ /* array of network devices */
+ struct pciefd_can *can[] __counted_by(can_count);
};
/* supported device ids. */
--
2.43.0
Powered by blists - more mailing lists