Skip to content

Commit c9a5baf

Browse files
Avenger-285714opsiff
authored andcommitted
scsi: sssraid: Replace zero-length array with flexible array member
Replace the zero-length array 'event_data[0]' with a C99 flexible array member 'event_data[]' in struct sssraid_fwevt. Zero-length arrays are a GNU extension that predates C99 flexible array members. The kernel's fortify-string checks treat zero-length arrays as having size 0, which causes false-positive warnings when memcpy() is used to copy data into them: In function 'fortify_memcpy_chk', inlined from 'sssraid_process_admin_cq.isra' at drivers/scsi/sssraid/sssraid_fw.c:1574:3: ./include/linux/fortify-string.h:597:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? This is part of the ongoing effort to replace all zero-length arrays with flexible array members, as recommended by the kernel coding style. Link: KSPP/linux#78 Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
1 parent e20d8c8 commit c9a5baf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/scsi/sssraid/sssraid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ struct sssraid_fwevt {
293293
bool process_evt;
294294
u32 evt_ctx;
295295
struct kref ref_count;
296-
char event_data[0] __aligned(4);
296+
char event_data[] __aligned(4);
297297
};
298298

299299
/*

0 commit comments

Comments
 (0)