[PATCH] fs/cifs: Replace one-element array with flexible-array member.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix the following coccicheck warning:

./fs/cifs/smb2pdu.h:1711:8-16: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/
process/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1509:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/
process/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1486:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/
process/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1478:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/
process/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1437:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1429:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/
process/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1389:26-31: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1389:26-31: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1366:6-12: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1330:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1319:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1299:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

./fs/cifs/smb2pdu.h:1284:8-14: WARNING use flexible-array
member instead(https://www.kernel.org/doc/html/latest/process
/deprecated.html#zero-length-and-one-element-arrays)

Reported-by: Abaci Robot<abaci@xxxxxxxxxxxxxxxxx>
Signed-off-by: Jiapeng Zhong <abaci-bugfix@xxxxxxxxxxxxxxxxx>
---
 fs/cifs/smb2pdu.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 204a622..7c9ac5d 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -1289,7 +1289,7 @@ struct smb2_read_plain_req {
 	__le32 RemainingBytes;
 	__le16 ReadChannelInfoOffset;
 	__le16 ReadChannelInfoLength;
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 /* Read flags */
@@ -1304,7 +1304,7 @@ struct smb2_read_rsp {
 	__le32 DataLength;
 	__le32 DataRemaining;
 	__u32  Flags;
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 /* For write request Flags field below the following flags are defined: */
@@ -1324,7 +1324,7 @@ struct smb2_write_req {
 	__le16 WriteChannelInfoOffset;
 	__le16 WriteChannelInfoLength;
 	__le32 Flags;
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 struct smb2_write_rsp {
@@ -1335,7 +1335,7 @@ struct smb2_write_rsp {
 	__le32 DataLength;
 	__le32 DataRemaining;
 	__u32  Reserved2;
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 /* notify flags */
@@ -1371,7 +1371,7 @@ struct smb2_change_notify_rsp {
 	__le16	StructureSize;  /* Must be 9 */
 	__le16	OutputBufferOffset;
 	__le32	OutputBufferLength;
-	__u8	Buffer[1]; /* array of file notify structs */
+	__u8	Buffer[]; /* array of file notify structs */
 } __packed;
 
 #define SMB2_LOCKFLAG_SHARED_LOCK	0x0001
@@ -1394,7 +1394,7 @@ struct smb2_lock_req {
 	__u64  PersistentFileId; /* opaque endianness */
 	__u64  VolatileFileId; /* opaque endianness */
 	/* Followed by at least one */
-	struct smb2_lock_element locks[1];
+	struct smb2_lock_element locks[];
 } __packed;
 
 struct smb2_lock_rsp {
@@ -1434,7 +1434,7 @@ struct smb2_query_directory_req {
 	__le16 FileNameOffset;
 	__le16 FileNameLength;
 	__le32 OutputBufferLength;
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 struct smb2_query_directory_rsp {
@@ -1442,7 +1442,7 @@ struct smb2_query_directory_rsp {
 	__le16 StructureSize; /* Must be 9 */
 	__le16 OutputBufferOffset;
 	__le32 OutputBufferLength;
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 /* Possible InfoType values */
@@ -1483,7 +1483,7 @@ struct smb2_query_info_req {
 	__le32 Flags;
 	__u64  PersistentFileId; /* opaque endianness */
 	__u64  VolatileFileId; /* opaque endianness */
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 struct smb2_query_info_rsp {
@@ -1491,7 +1491,7 @@ struct smb2_query_info_rsp {
 	__le16 StructureSize; /* Must be 9 */
 	__le16 OutputBufferOffset;
 	__le32 OutputBufferLength;
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 /*
@@ -1514,7 +1514,7 @@ struct smb2_set_info_req {
 	__le32 AdditionalInformation;
 	__u64  PersistentFileId; /* opaque endianness */
 	__u64  VolatileFileId; /* opaque endianness */
-	__u8   Buffer[1];
+	__u8   Buffer[];
 } __packed;
 
 struct smb2_set_info_rsp {
@@ -1716,7 +1716,7 @@ struct smb2_file_all_info { /* data block encoding of response to level 18 */
 	__le32 Mode;
 	__le32 AlignmentRequirement;
 	__le32 FileNameLength;
-	char   FileName[1];
+	char   FileName[];
 } __packed; /* level 18 Query */
 
 struct smb2_file_eof_info { /* encoding of request for level 10 */
-- 
1.8.3.1




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux