Re: [PATCH v2 21/27] xfsprogs: Remove single byte array from struct parent

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

 



On Sun, Jun 10, 2018 at 8:07 AM, Allison Henderson
<allison.henderson@xxxxxxxxxx> wrote:
> Variable sized arrays implemented this way may cause
> corruptions depending on how different compilers pack
> the structure.
>
> Signed-off-by: Allison Henderson <allison.henderson@xxxxxxxxxx>
> ---
>  include/parent.h | 1 -
>  io/parent.c      | 9 ++++++---
>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/include/parent.h b/include/parent.h
> index f338f96..85cef85 100644
> --- a/include/parent.h
> +++ b/include/parent.h
> @@ -22,7 +22,6 @@ typedef struct parent {
>         __u64   p_ino;
>         __u32   p_gen;
>         __u16   p_reclen;
> -       char    p_name[1];

How about
   char    p_name[0];

Is that also risky? keeps the code cleaner IMO.
Second best, at least have a macro to access p_name
instead of open coding ((char*)parent)+sizeof(struct parent))
all the time. First option is much better IMO.

Thanks,
Amir.
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux