Whamcloud - gitweb
LU-14093 ptlrpc: redefine uop_params_off to support gcc10 86/40486/2
authorAlex Zhuravlev <bzzz@whamcloud.com>
Fri, 30 Oct 2020 07:02:18 +0000 (10:02 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 7 Nov 2020 08:15:24 +0000 (08:15 +0000)
otherwise gcc10 complains about out-of-boundry access:

llog_swab.c: In function lustre_swab_update_ops:
llog_swab.c:137:46: error: array subscript 65534 is outside the bounds
of an interior zero-length array__u16[0] {aka short unsigned int[]}
[-Werror=zero-length-bounds]
  137 |    __swab16s(&uops->uops_op[i].uop_params_off[j]);

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I27981cbc79991cbd7a79cb90aec97bd1dc8b2f1b
Reviewed-on: https://review.whamcloud.com/40486
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/ptlrpc/wiretest.c
lustre/utils/wiretest.c

index 9390aac..d8fd6b2 100644 (file)
@@ -3488,7 +3488,7 @@ struct update_op {
        struct lu_fid   uop_fid;
        __u16           uop_type;
        __u16           uop_param_count;
        struct lu_fid   uop_fid;
        __u16           uop_type;
        __u16           uop_param_count;
-       __u16           uop_params_off[0];
+       __u16           uop_params_off[];
 } __attribute__((packed));
 
 struct update_ops {
 } __attribute__((packed));
 
 struct update_ops {
index a9167f2..765aa62 100644 (file)
@@ -5625,8 +5625,6 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)sizeof(((struct update_op *)0)->uop_param_count));
        LASSERTF((int)offsetof(struct update_op, uop_params_off) == 20, "found %lld\n",
                 (long long)(int)offsetof(struct update_op, uop_params_off));
                 (long long)(int)sizeof(((struct update_op *)0)->uop_param_count));
        LASSERTF((int)offsetof(struct update_op, uop_params_off) == 20, "found %lld\n",
                 (long long)(int)offsetof(struct update_op, uop_params_off));
-       LASSERTF((int)sizeof(((struct update_op *)0)->uop_params_off) == 0, "found %lld\n",
-                (long long)(int)sizeof(((struct update_op *)0)->uop_params_off));
 
        /* Checks for struct update_ops */
        LASSERTF((int)sizeof(struct update_ops) == 0, "found %lld\n",
 
        /* Checks for struct update_ops */
        LASSERTF((int)sizeof(struct update_ops) == 0, "found %lld\n",
index 399084e..ab7ad31 100644 (file)
@@ -5657,8 +5657,6 @@ void lustre_assert_wire_constants(void)
                 (long long)(int)sizeof(((struct update_op *)0)->uop_param_count));
        LASSERTF((int)offsetof(struct update_op, uop_params_off) == 20, "found %lld\n",
                 (long long)(int)offsetof(struct update_op, uop_params_off));
                 (long long)(int)sizeof(((struct update_op *)0)->uop_param_count));
        LASSERTF((int)offsetof(struct update_op, uop_params_off) == 20, "found %lld\n",
                 (long long)(int)offsetof(struct update_op, uop_params_off));
-       LASSERTF((int)sizeof(((struct update_op *)0)->uop_params_off) == 0, "found %lld\n",
-                (long long)(int)sizeof(((struct update_op *)0)->uop_params_off));
 
        /* Checks for struct update_ops */
        LASSERTF((int)sizeof(struct update_ops) == 0, "found %lld\n",
 
        /* Checks for struct update_ops */
        LASSERTF((int)sizeof(struct update_ops) == 0, "found %lld\n",