Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: libfc: Replace one-element arrays with flexible-array members

Use flexible-array members in struct fc_fdmi_attr_entry and fs_fdmi_attrs
instead of one-element arrays, and refactor the code accordingly.

Also, this helps with the ongoing efforts to globally enable -Warray-bounds
and get us closer to being able to tighten the FORTIFY_SOURCE routines on
memcpy().

https://github.com/KSPP/linux/issues/79
https://github.com/ClangBuiltLinux/linux/issues/1590

Link: https://lore.kernel.org/r/20220214223903.GA859464@embeddedor
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Gustavo A. R. Silva and committed by
Martin K. Petersen
c5b483d5 b709a4ca

+3 -3
+1 -1
drivers/scsi/libfc/fc_encode.h
··· 246 246 &entry->type); 247 247 put_unaligned_be16(len, &entry->len); 248 248 put_unaligned_be64(lport->wwnn, 249 - (__be64 *)&entry->value[0]); 249 + (__be64 *)&entry->value); 250 250 251 251 /* Manufacturer */ 252 252 entry = (struct fc_fdmi_attr_entry *)((char *)entry->value +
+2 -2
include/scsi/fc/fc_ms.h
··· 158 158 struct fc_fdmi_attr_entry { 159 159 __be16 type; 160 160 __be16 len; 161 - __u8 value[1]; 161 + __u8 value[]; 162 162 } __attribute__((__packed__)); 163 163 164 164 /* ··· 166 166 */ 167 167 struct fs_fdmi_attrs { 168 168 __be32 numattrs; 169 - struct fc_fdmi_attr_entry attr[1]; 169 + struct fc_fdmi_attr_entry attr[]; 170 170 } __attribute__((__packed__)); 171 171 172 172 /*