Skip to contentSkip to conversation

sentinel_ctltable: Add a check for sentinel elements in ctl_table arrays

PATCH Applied Joel Granados 2 participants 2 messages Jun 14, 2024 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sentinel_ctltable: Add a check for sentinel elements in ctl_table arrays

Added a new check named check_sentinel_ctltable that prints a warning when a sentinel element is detected in a ctl_table struct array. Sentinels marking the end of a ctl_table array where completely removed from the linux kernel in [1]. We add this warning to avoid cases where a sentinel gets added by mistake.

[1] https://lore.kernel.org/[email protected]

---

--

---
 check_list.h              |  1 +
 check_sentinel_ctltable.c | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)
check_list.h +1 -0
index 7115b069..a870c95f 100644
@@ -252,6 +252,7 @@ CK(check_direct_return_instead_of_goto)
 CK(check_double_fget)
 CK(check_negative_error_code_type_promoted)
 CK(check_uninitialized_kobj)
+CK(check_sentinel_ctltable)
 
 /* wine specific stuff */
 CK(check_wine_filehandles)
check_sentinel_ctltable.c new file +41 -0

41 lines not on this page · raw message

---
base-commit: ff1cc4d453ffeddf3cf3dc031c5b129eefbf3e2c
change-id: 20240614-master-db259d890db0

Best regards,

Signature · 1 line
Joel Granados <[email protected]>
#1 lore raw
Quoted 8 lines · On Fri, Jun 14, 2024 at 02:29:41PM +0200, Joel Granados via B4 Relay wrote:

From: Joel Granados <[email protected]>

Added a new check named check_sentinel_ctltable that prints a warning when a sentinel element is detected in a ctl_table struct array. Sentinels marking the end of a ctl_table array where completely removed from the linux kernel in [1]. We add this warning to avoid cases where a sentinel gets added by mistake.

Quoted 4 lines

[1] https://lore.kernel.org/[email protected]

---

Applied, thanks!

regards,
dan carpenter