Skip to content

Commit d71f223

Browse files
GustavoARSilvakees
authored andcommitted
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 1ee6035 ("gcc-plugins: randstruct: Only warn about true flexible arrays") Signed-off-by: "Gustavo A. R. Silva" <[email protected]> Link: https://lore.kernel.org/r/ZWJr2MWDjXLHE8ap@work Fixes: 1ee6035 ("gcc-plugins: randstruct: Only warn about true flexible arrays") Signed-off-by: Kees Cook <[email protected]>
1 parent 4e86f32 commit d71f223

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

scripts/gcc-plugins/randomize_layout_plugin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,7 @@ static int relayout_struct(tree type)
339339

340340
/*
341341
* enforce that we don't randomize the layout of the last
342-
* element of a struct if it's a 0 or 1-length array
343-
* or a proper flexible array
342+
* element of a struct if it's a proper flexible array
344343
*/
345344
if (is_flexible_array(newtree[num_fields - 1])) {
346345
has_flexarray = true;

0 commit comments

Comments
 (0)