1From 194c626f2a026233b7383d75225419ab66389aaa Mon Sep 17 00:00:00 2001 2From: Alistair Francis <alistair.francis@wdc.com> 3Date: Tue, 24 Sep 2019 21:55:36 +0100 4Subject: [PATCH 19/20] inet/net-internal.h: Fix uninitalised clntudp_call() 5 variable 6 7The total_deadline variable inside the clntudp_call() function inside 8sunrpc/clnt_udp.c can cause uninitalised variable warnings when building 9with GCC 8.3 or 9.2 on a platform with a 64-bit tv_nsec on a 32-bit 10architecture. To fix the warning let's use the DIAG_* macros to hide the 11warning. 12 13A GCC bug case has also been submitted: 14 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691 15 162019-09-24 Alistair Francis <alistair.francis@wdc.com> 17 18 * inet/net-internal.h: Fix uninitalised clntudp_call() variable. 19 20Reviewed-by: Carlos O'Donell <carlos@redhat.com> 21(cherry picked from commit 5d245b5f8d9663953c20107e3bb16fe249e48126) 22Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 23--- 24 inet/net-internal.h | 13 +++++++++++++ 25 1 file changed, 13 insertions(+) 26 27diff --git a/inet/net-internal.h b/inet/net-internal.h 28index 0ba6736a..7019d23b 100644 29--- a/inet/net-internal.h 30+++ b/inet/net-internal.h 31@@ -23,6 +23,7 @@ 32 #include <stdbool.h> 33 #include <stdint.h> 34 #include <sys/time.h> 35+#include <libc-diag.h> 36 37 int __inet6_scopeid_pton (const struct in6_addr *address, 38 const char *scope, uint32_t *result); 39@@ -96,6 +97,16 @@ __deadline_is_infinite (struct deadline deadline) 40 return deadline.absolute.tv_nsec < 0; 41 } 42 43+/* GCC 8.3 and 9.2 both incorrectly report total_deadline 44+ * (from sunrpc/clnt_udp.c) as maybe-uninitialized when tv_sec is 8 bytes 45+ * (64-bits) wide on 32-bit systems. We have to set -Wmaybe-uninitialized 46+ * here as it won't fix the error in sunrpc/clnt_udp.c. 47+ * A GCC bug has been filed here: 48+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91691 49+ */ 50+DIAG_PUSH_NEEDS_COMMENT; 51+DIAG_IGNORE_NEEDS_COMMENT (9, "-Wmaybe-uninitialized"); 52+ 53 /* Return true if the current time is at the deadline or past it. */ 54 static inline bool 55 __deadline_elapsed (struct deadline_current_time current, 56@@ -120,6 +131,8 @@ __deadline_first (struct deadline left, struct deadline right) 57 return right; 58 } 59 60+DIAG_POP_NEEDS_COMMENT; 61+ 62 /* Add TV to the current time and return it. Returns a special 63 infinite absolute deadline on overflow. */ 64 struct deadline __deadline_from_timeval (struct deadline_current_time, 65-- 662.20.1 67 68