Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6a9746f

Browse files
GustavoARSilvagregkh
authored andcommitted
USB: atm: Replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array languageextension to the C90 standard, but the preferred mechanism to declarevariable-length types such as these ones is a flexible array member[1][2],introduced in C99:struct foo { int stuff; struct boo array[];};By making use of the mechanism above, we will get a compiler warningin case the flexible array does not occur last in the structure, whichwill help us prevent some kind of undefined behavior bugs from beinginadvertenly introduced[3] to the codebase from now on.This issue was found with the help of Coccinelle.[1]https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html[2]KSPP#21[3] commit7649773 ("cxgb3/l2t: Fix undefined behaviour")Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>Link:https://lore.kernel.org/r/20200211232148.GA20644@embeddedorSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parentd80bdab commit6a9746f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎drivers/usb/atm/ueagle-atm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ struct l1_code {
350350
u8string_header[E4_L1_STRING_HEADER];
351351
u8page_number_to_block_index[E4_MAX_PAGE_NUMBER];
352352
structblock_indexpage_header[E4_NO_SWAPPAGE_HEADERS];
353-
u8code[0];
353+
u8code[];
354354
}__packed;
355355

356356
/* structures describing a block within a DSP page */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp