Skip to contentSkip to conversation

gcc-plugins: randstruct: Update code comment in relayout_struct()

PATCH Applied Gustavo A. R. Silva 2 participants 2 messages Nov 25, 2023 – Nov 28, 2023 Gcc plugins

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc-plugins: randstruct: Update code comment in relayout_struct()

Update code comment to clarify that the only element whose layout is not randomized is a proper C99 flexible-array member. This update is complementary to commit 1ee60356c2dc ("gcc-plugins: randstruct: Only warn about true flexible arrays")

---
 scripts/gcc-plugins/randomize_layout_plugin.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
scripts/gcc-plugins/randomize_layout_plugin.c +1 -2
index 910bd21d08f4..746ff2d272f2 100644
@@ -339,8 +339,7 @@ static int relayout_struct(tree type)
 
 	/*
 	 * enforce that we don't randomize the layout of the last
-	 * element of a struct if it's a 0 or 1-length array
-	 * or a proper flexible array
+	 * element of a struct if it's a proper flexible array
 	 */
 	if (is_flexible_array(newtree[num_fields - 1])) {
 		has_flexarray = true;
Signature · 1 line
2.34.1
Applied
#1 lore raw
Quoted 6 lines · Gustavo A. R. Silva

Update code comment to clarify that the only element whose layout is not randomized is a proper C99 flexible-array member. This update is complementary to commit 1ee60356c2dc ("gcc-plugins: randstruct: Only warn about true flexible arrays")

Applied to for-linus/hardening, thanks!

[1/1] gcc-plugins: randstruct: Update code comment in relayout_struct()

      https://git.kernel.org/kees/c/d71f22365a9c

Take care,

Signature · 1 line
Kees Cook