Re: [PATCH 1/2] dbus: add dbus-over-tcp support

Denis Kenzior <[email protected]> Thu, 16 May 2024 14:33:18 -0500
Newsgroups dev.linux.lists.ell
Message-ID <[email protected]>
Hi Ram,

On 5/13/24 12:58 PM, Ram Subramanian wrote:
> l_dbus_new() will now accept tcp endpoints, however it will only accept
> a numeric address for 'host'; it will not resolve hostnames. This is so
> we can avoid a potential long, blocking call to getaddrinfo().
> 
> The connect() call to the host is also non-blocking. This means that
> auth will not happen until you start the event loop (with a call to
> l_main_run() et. al.).
> 
> Co-authored-by: Ramon Ribeiro <[email protected]>
> ---
>   ell/dbus.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 111 insertions(+)

<snip>

> +static struct l_dbus *setup_tcp(char *params)
> +{
> +	char *host = NULL;
> +	char *port = NULL;
> +	char *family = NULL;
> +	struct addrinfo hints = { 0 };
> +	struct addrinfo *res;
> +	struct addrinfo *iter;
> +	struct l_dbus *dbus;
> +

CI caught this one:

Clang Build
Test ID: clang
Desc: Build IWD using clang compiler
Duration: 72.29 seconds
Result: FAIL

Output:

ell/dbus.c:1217:19: error: variable 'dbus' is used uninitialized whenever 'for' 
loop exits because its condition is false [-Werror,-Wsometimes-uninitialized]
         for (iter = res; iter; iter = iter->ai_next) {
                          ^~~~
ell/dbus.c:1241:9: note: uninitialized use occurs here
         return dbus;
                ^~~~
ell/dbus.c:1217:19: note: remove the condition if it is always true
         for (iter = res; iter; iter = iter->ai_next) {
                          ^~~~
ell/dbus.c:1178:21: note: initialize the variable 'dbus' to silence this warning
         struct l_dbus *dbus;
                            ^
                             = NULL
1 error generated.
make[1]: *** [Makefile:2560: ell/dbus.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1716: all] Error 2

So I changed this line to read:
struct l_dbus *dbus = NULL;

Applied, thanks.

Regards,
-Denis