* [PATCH] NFS: Replace one-element array with flexible-array member
@ 2022-01-14 0:57 cgel.zte
2022-01-14 3:59 ` Trond Myklebust
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-01-14 0:57 UTC (permalink / raw)
To: trond.myklebust
Cc: anna.schumaker, linux-nfs, linux-kernel, Changcheng Deng, Zeal Robot
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 1036 bytes --]
From: Changcheng Deng <deng.changcheng@zte.com.cn>
There is a regular need in the kernel to provide a way to declare having
a dynamically sized set of trailing elements in a structure. Kernel code
should always use “flexible array members” for these cases. The older
style of one-element or zero-length arrays should no longer be used.
Reference:
https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-
and-one-element-arrays
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
---
include/linux/nfs_xdr.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 39390d9df9e1..7f51edd5785a 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -421,7 +421,7 @@ struct nfs42_layout_error {
__u64 offset;
__u64 length;
nfs4_stateid stateid;
- struct nfs42_device_error errors[1];
+ struct nfs42_device_error errors[];
};
#define NFS42_LAYOUTERROR_MAX 5
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] NFS: Replace one-element array with flexible-array member
2022-01-14 0:57 [PATCH] NFS: Replace one-element array with flexible-array member cgel.zte
@ 2022-01-14 3:59 ` Trond Myklebust
0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2022-01-14 3:59 UTC (permalink / raw)
To: cgel.zte; +Cc: linux-nfs, deng.changcheng, anna.schumaker, linux-kernel, zealci
On Fri, 2022-01-14 at 00:57 +0000, cgel.zte@gmail.com wrote:
> From: Changcheng Deng <deng.changcheng@zte.com.cn>
>
> There is a regular need in the kernel to provide a way to declare
> having
> a dynamically sized set of trailing elements in a structure. Kernel
> code
> should always use “flexible array members” for these cases. The older
> style of one-element or zero-length arrays should no longer be used.
>
> Reference:
> https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length
> -
> and-one-element-arrays
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
> ---
> include/linux/nfs_xdr.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
> index 39390d9df9e1..7f51edd5785a 100644
> --- a/include/linux/nfs_xdr.h
> +++ b/include/linux/nfs_xdr.h
> @@ -421,7 +421,7 @@ struct nfs42_layout_error {
> __u64 offset;
> __u64 length;
> nfs4_stateid stateid;
> - struct nfs42_device_error errors[1];
> + struct nfs42_device_error errors[];
> };
>
> #define NFS42_LAYOUTERROR_MAX 5
NACK. This is a fixed size array of length 1, not a variable size
array. Please fix your tool.
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-14 3:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 0:57 [PATCH] NFS: Replace one-element array with flexible-array member cgel.zte
2022-01-14 3:59 ` Trond Myklebust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome