From 99ad32e7b9af807ef80d074c901a4d390c1ac0a1 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Fri, 30 Oct 2020 10:02:18 +0300 Subject: [PATCH] LU-14093 ptlrpc: redefine uop_params_off to support gcc10 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 Change-Id: I27981cbc79991cbd7a79cb90aec97bd1dc8b2f1b Reviewed-on: https://review.whamcloud.com/40486 Tested-by: jenkins Reviewed-by: Shaun Tancheff Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/uapi/linux/lustre/lustre_idl.h | 2 +- lustre/ptlrpc/wiretest.c | 2 -- lustre/utils/wiretest.c | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 9390aac..d8fd6b2 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -3488,7 +3488,7 @@ struct update_op { 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 { diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index a9167f2..765aa62 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -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)); - 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", diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 399084e..ab7ad31 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -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)); - 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", -- 1.8.3.1