RE: [PATCH] rsockets: fix variable initialization

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

 



I apologize for sending this twice. I thought it wasn't received the first time.
Please ignore this thread.

Thanks,
Ali

> -----Original Message-----
> From: linux-rdma-owner@xxxxxxxxxxxxxxx <linux-rdma-
> owner@xxxxxxxxxxxxxxx> On Behalf Of Ali Alnubani
> Sent: Thursday, June 27, 2019 5:49 PM
> To: linux-rdma@xxxxxxxxxxxxxxx
> Cc: sean.hefty@xxxxxxxxx
> Subject: [PATCH] rsockets: fix variable initialization
> 
> This is to fix the error:
>   ```
>   [117/380] Building C object librdmacm/CMakeFiles/rdmacm.dir/rsocket.c.o
>   FAILED: librdmacm/CMakeFiles/rdmacm.dir/rsocket.c.o
>   /usr/bin/cc  -D_FILE_OFFSET_BITS=64 -Drdmacm_EXPORTS -Werror -m32
>   -std=gnu11 -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter
>   -Wmissing-prototypes -Wmissing-declarations -Wwrite-strings -Wformat=2
>   -Wformat-nonliteral -Wredundant-decls -Wnested-externs -Wshadow
>   -Wno-missing-field-initializers -Wstrict-prototypes
>   -Wold-style-definition -Wredundant-decls -O2 -g  -fPIC -Iinclude -MMD
>   -MT librdmacm/CMakeFiles/rdmacm.dir/rsocket.c.o -MF
>   "librdmacm/CMakeFiles/rdmacm.dir/rsocket.c.o.d" -o
>   librdmacm/CMakeFiles/rdmacm.dir/rsocket.c.o   -c ../librdmacm/rsocket.c
>   ../librdmacm/rsocket.c: In function ‘rs_get_comp’:
>   ../librdmacm/rsocket.c:2148:15: error: ‘start_time’ may be used
>   uninitialized in this function [-Werror=maybe-uninitialized]
>      poll_time = (uint32_t) (rs_time_us() - start_time);
>                  ^
>   ../librdmacm/rsocket.c: In function ‘ds_get_comp’:
>   ../librdmacm/rsocket.c:2307:15: error: ‘start_time’ may be used
>   uninitialized in this function [-Werror=maybe-uninitialized]
>      poll_time = (uint32_t) (rs_time_us() - start_time);
>                  ^
>   ../librdmacm/rsocket.c: In function ‘rpoll’:
>   ../librdmacm/rsocket.c:3321:15: error: ‘start_time’ may be used
>   uninitialized in this function [-Werror=maybe-uninitialized]
>      poll_time = (uint32_t) (rs_time_us() - start_time);
>                  ^
>   cc1: all warnings being treated as errors
>   [122/380] Building C object providers/efa/CMakeFiles/efa.dir/verbs.c.o
>   ninja: build stopped: subcommand failed.
>   ```
> Which reproduces on RHEL7.5 with 4.8.5 20150623 (Red Hat 4.8.5-28) and 32-
> bit libraries.
> 
> Build steps to reproduce:
>   ```
>   mkdir build32 && cd build32 && CFLAGS="-Werror -m32" cmake -GNinja \
>   -DENABLE_RESOLVE_NEIGH=0 -DIOCTL_MODE=both -DNO_PYVERBS=1 &&
> \
>   ninja-build
>   ```
> 
> meson version: 0.47.2
> ninja-build version: 1.7.2
> 
> Fixes: 38c49232b67a ("rsockets: Replace gettimeofday with clock_gettime")
> Cc: sean.hefty@xxxxxxxxx
> 
> Signed-off-by: Ali Alnubani <alialnu@xxxxxxxxxxxx>
> ---
>  librdmacm/rsocket.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/librdmacm/rsocket.c b/librdmacm/rsocket.c index
> 58de2856..aa912c1a 100644
> --- a/librdmacm/rsocket.c
> +++ b/librdmacm/rsocket.c
> @@ -2133,7 +2133,7 @@ static int rs_process_cq(struct rsocket *rs, int
> nonblock, int (*test)(struct rs
> 
>  static int rs_get_comp(struct rsocket *rs, int nonblock, int (*test)(struct
> rsocket *rs))  {
> -	uint64_t start_time;
> +	uint64_t start_time = 0;
>  	uint32_t poll_time = 0;
>  	int ret;
> 
> @@ -2292,7 +2292,7 @@ static int ds_process_cqs(struct rsocket *rs, int
> nonblock, int (*test)(struct r
> 
>  static int ds_get_comp(struct rsocket *rs, int nonblock, int (*test)(struct
> rsocket *rs))  {
> -	uint64_t start_time;
> +	uint64_t start_time = 0;
>  	uint32_t poll_time = 0;
>  	int ret;
> 
> @@ -3306,7 +3306,7 @@ static int rs_poll_events(struct pollfd *rfds, struct
> pollfd *fds, nfds_t nfds)  int rpoll(struct pollfd *fds, nfds_t nfds, int timeout)
> {
>  	struct pollfd *rfds;
> -	uint64_t start_time;
> +	uint64_t start_time = 0;
>  	uint32_t poll_time = 0;
>  	int pollsleep, ret;
> 
> --
> 2.22.0





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux