Skip to content

Commit 64b6dea

Browse files
keesmartinkpetersen
authored andcommitted
scsi: uapi: Replace 0-length array with flexible array
Zero-length arrays are deprecated[1]. Replace struct fc_bsg_host_vendor_reply's "vendor_rsp" 0-length array with a flexible array. Detected with GCC 13, using -fstrict-flex-arrays=3: drivers/scsi/qla2xxx/qla_isr.c: In function 'qla25xx_process_bidir_status_iocb.isra': drivers/scsi/qla2xxx/qla_isr.c:3117:54: warning: array subscript 0 is outside array bounds of '__u32[0]' {aka 'unsigned int[]'} [-Warray-bounds=] 3117 | bsg_reply->reply_data.vendor_reply.vendor_rsp[0] = rval; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from drivers/scsi/qla2xxx/qla_def.h:34, from drivers/scsi/qla2xxx/qla_isr.c:6: include/uapi/scsi/scsi_bsg_fc.h:219:15: note: while referencing 'vendor_rsp' 219 | __u32 vendor_rsp[0]; | ^~~~~~~~~~ [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays Cc: Martin K. Petersen <[email protected]> Cc: Dan Williams <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 201e0a7 commit 64b6dea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/uapi/scsi/scsi_bsg_fc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ struct fc_bsg_host_vendor {
216216
*/
217217
struct fc_bsg_host_vendor_reply {
218218
/* start of vendor response area */
219-
__u32 vendor_rsp[0];
219+
__DECLARE_FLEX_ARRAY(__u32, vendor_rsp);
220220
};
221221

222222

0 commit comments

Comments
 (0)