diff mbox series

ksmbd: Replace one-element arrays with flexible-array members

Message ID 20240816135823.87543-1-thorsten.blum@toblux.com (mailing list archive)
State Superseded
Headers show
Series ksmbd: Replace one-element arrays with flexible-array members | expand

Commit Message

Thorsten Blum Aug. 16, 2024, 1:58 p.m. UTC
Replace the deprecated one-element arrays with flexible-array members
in the structs filesystem_attribute_info and filesystem_device_info.

Link: https://github.com/KSPP/linux/issues/79
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 fs/smb/server/smb_common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Gustavo A. R. Silva Aug. 16, 2024, 2:55 p.m. UTC | #1
On 16/08/24 07:58, Thorsten Blum wrote:
> Replace the deprecated one-element arrays with flexible-array members
> in the structs filesystem_attribute_info and filesystem_device_info.


Notice that this also affects the size of the involved structs.

I encourage you to study some of the patches that have previously
addressed similar issues.

Thanks
--
Gustavo

> 
> Link: https://github.com/KSPP/linux/issues/79
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
>   fs/smb/server/smb_common.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/smb/server/smb_common.h b/fs/smb/server/smb_common.h
> index 4a3148b0167f..cc1d6dfe29d5 100644
> --- a/fs/smb/server/smb_common.h
> +++ b/fs/smb/server/smb_common.h
> @@ -213,7 +213,7 @@ struct filesystem_attribute_info {
>   	__le32 Attributes;
>   	__le32 MaxPathNameComponentLength;
>   	__le32 FileSystemNameLen;
> -	__le16 FileSystemName[1]; /* do not have to save this - get subset? */
> +	__le16 FileSystemName[]; /* do not have to save this - get subset? */
>   } __packed;
>   
>   struct filesystem_device_info {
> @@ -226,7 +226,7 @@ struct filesystem_vol_info {
>   	__le32 SerialNumber;
>   	__le32 VolumeLabelSize;
>   	__le16 Reserved;
> -	__le16 VolumeLabel[1];
> +	__le16 VolumeLabel[];
>   } __packed;
>   
>   struct filesystem_info {
Thorsten Blum Aug. 16, 2024, 3:43 p.m. UTC | #2
On 16. Aug 2024, at 16:55, Gustavo A. R. Silva <gustavo@embeddedor.com> wrote:
> On 16/08/24 07:58, Thorsten Blum wrote:
>> Replace the deprecated one-element arrays with flexible-array members
>> in the structs filesystem_attribute_info and filesystem_device_info.
> 
> Notice that this also affects the size of the involved structs.
> 
> I encourage you to study some of the patches that have previously
> addressed similar issues.

Thanks. I'll take a look and submit a v2.
diff mbox series

Patch

diff --git a/fs/smb/server/smb_common.h b/fs/smb/server/smb_common.h
index 4a3148b0167f..cc1d6dfe29d5 100644
--- a/fs/smb/server/smb_common.h
+++ b/fs/smb/server/smb_common.h
@@ -213,7 +213,7 @@  struct filesystem_attribute_info {
 	__le32 Attributes;
 	__le32 MaxPathNameComponentLength;
 	__le32 FileSystemNameLen;
-	__le16 FileSystemName[1]; /* do not have to save this - get subset? */
+	__le16 FileSystemName[]; /* do not have to save this - get subset? */
 } __packed;
 
 struct filesystem_device_info {
@@ -226,7 +226,7 @@  struct filesystem_vol_info {
 	__le32 SerialNumber;
 	__le32 VolumeLabelSize;
 	__le16 Reserved;
-	__le16 VolumeLabel[1];
+	__le16 VolumeLabel[];
 } __packed;
 
 struct filesystem_info {