diff mbox series

ksmbd: fix flexible_array.cocci warnings

Message ID 20211103131901.28695-1-guozhengkui@vivo.com (mailing list archive)
State New, archived
Headers show
Series ksmbd: fix flexible_array.cocci warnings | expand

Commit Message

Guo Zhengkui Nov. 3, 2021, 1:19 p.m. UTC
Fix following coccicheck warning:
./fs/ksmbd/transport_rdma.c:201:20-27: WARNING use flexible-array
member instead.

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 fs/ksmbd/transport_rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Namjae Jeon Nov. 3, 2021, 1:51 p.m. UTC | #1
2021-11-03 22:19 GMT+09:00, Guo Zhengkui <guozhengkui@vivo.com>:
> Fix following coccicheck warning:
> ./fs/ksmbd/transport_rdma.c:201:20-27: WARNING use flexible-array
> member instead.
Is there only one here? It would be better to change them together in
this patch.
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> ---
>  fs/ksmbd/transport_rdma.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c
> index 6330dfc302ff..ca62060acd2b 100644
> --- a/fs/ksmbd/transport_rdma.c
> +++ b/fs/ksmbd/transport_rdma.c
> @@ -198,7 +198,7 @@ struct smb_direct_rdma_rw_msg {
>  	struct completion	*completion;
>  	struct rdma_rw_ctx	rw_ctx;
>  	struct sg_table		sgt;
> -	struct scatterlist	sg_list[0];
> +	struct scatterlist	sg_list[];
>  };
>
>  static inline int get_buf_page_count(void *buf, int size)
> --
> 2.20.1
>
>
Sergey Senozhatsky Nov. 4, 2021, 12:10 a.m. UTC | #2
On (21/11/03 22:51), Namjae Jeon wrote:
> 
> 2021-11-03 22:19 GMT+09:00, Guo Zhengkui <guozhengkui@vivo.com>:
> > Fix following coccicheck warning:
> > ./fs/ksmbd/transport_rdma.c:201:20-27: WARNING use flexible-array
> > member instead.
> Is there only one here? It would be better to change them together in
> this patch.

I guess I see more than one

fs/ksmbd/ksmbd_netlink.h:       __u8    spnego_blob[0];         /*
fs/ksmbd/ntlmssp.h:     __u8 Content[0];
fs/ksmbd/ntlmssp.h:     char DomainString[0];
fs/ksmbd/ntlmssp.h:     char UserString[0];
fs/ksmbd/smb2pdu.h:     __u8   Buffer[0];
fs/ksmbd/smb2pdu.h:     __u8 Buffer[0];
fs/ksmbd/smb2pdu.h:     char   FileName[0];     /* New name to be assigned */
fs/ksmbd/smb2pdu.h:     char   FileName[0];     /* Name to be assigned to new link */
fs/ksmbd/smb2pdu.h:     char FileName[0];
fs/ksmbd/smb2pdu.h:     char   StreamName[0];
fs/ksmbd/transport_rdma.c:      struct scatterlist      sg_list[0];
diff mbox series

Patch

diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c
index 6330dfc302ff..ca62060acd2b 100644
--- a/fs/ksmbd/transport_rdma.c
+++ b/fs/ksmbd/transport_rdma.c
@@ -198,7 +198,7 @@  struct smb_direct_rdma_rw_msg {
 	struct completion	*completion;
 	struct rdma_rw_ctx	rw_ctx;
 	struct sg_table		sgt;
-	struct scatterlist	sg_list[0];
+	struct scatterlist	sg_list[];
 };
 
 static inline int get_buf_page_count(void *buf, int size)