connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] build: Fix compiler maybe-uninitialized warnings
@ 2021-09-13  7:17 VAUTRIN Emmanuel (Canal Plus Prestataire)
  2021-09-13  7:27 ` Daniel Wagner
  0 siblings, 1 reply; 5+ messages in thread
From: VAUTRIN Emmanuel (Canal Plus Prestataire) @ 2021-09-13  7:17 UTC (permalink / raw)
  To: connman


---
 src/config.c           | 6 ++----
 src/dnsproxy.c         | 2 +-
 tools/ip6tables-test.c | 2 +-
 tools/iptables-test.c  | 2 +-
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/config.c b/src/config.c
index 62023b1072da..33fdc7375c15 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1106,8 +1106,7 @@ static char *config_pem_fsid(const char *pem_file)
 
 static void provision_service_wifi(struct connman_config_service *config,
 				struct connman_service *service,
-				struct connman_network *network,
-				const void *ssid, unsigned int ssid_len)
+				struct connman_network *network)
 {
 	if (config->eap)
 		__connman_service_set_string(service, "EAP", config->eap);
@@ -1418,8 +1417,7 @@ static int try_provision_service(struct connman_config_service *config,
 						config->timeservers);
 
 	if (type == CONNMAN_SERVICE_TYPE_WIFI) {
-		provision_service_wifi(config, service, network,
-							ssid, ssid_len);
+		provision_service_wifi(config, service, network);
 	}
 
 	__connman_service_mark_dirty();
diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index 4b65b3790bb9..fbbee0413f8f 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -2707,7 +2707,7 @@ static void update_domain(int index, const char *domain, bool append)
 	for (list = server_list; list; list = list->next) {
 		struct server_data *data = list->data;
 		GList *dom_list;
-		char *dom;
+		char *dom = NULL;
 		bool dom_found = false;
 
 		if (data->index < 0)
diff --git a/tools/ip6tables-test.c b/tools/ip6tables-test.c
index 41e842dd64af..a52f4af04edf 100644
--- a/tools/ip6tables-test.c
+++ b/tools/ip6tables-test.c
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
 {
 	enum iptables_command cmd = IPTABLES_COMMAND_UNKNOWN;
 	char *table = NULL, *chain = NULL, *rule = NULL, *tmp;
-	int err, c, i;
+	int err = -EINVAL, c, i;
 
 	opterr = 0;
 
diff --git a/tools/iptables-test.c b/tools/iptables-test.c
index e9b7cb224d7a..f9d091eb9490 100644
--- a/tools/iptables-test.c
+++ b/tools/iptables-test.c
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
 {
 	enum iptables_command cmd = IPTABLES_COMMAND_UNKNOWN;
 	char *table = NULL, *chain = NULL, *rule = NULL, *tmp;
-	int err, c, i;
+	int err = -EINVAL, c, i;
 
 	opterr = 0;
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: Fix compiler maybe-uninitialized warnings
  2021-09-13  7:17 [PATCH] build: Fix compiler maybe-uninitialized warnings VAUTRIN Emmanuel (Canal Plus Prestataire)
@ 2021-09-13  7:27 ` Daniel Wagner
  2021-09-13  7:45   ` VAUTRIN Emmanuel (Canal Plus Prestataire)
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Wagner @ 2021-09-13  7:27 UTC (permalink / raw)
  To: VAUTRIN Emmanuel (Canal Plus Prestataire); +Cc: connman

Hi Emmanuel,

On Mon, Sep 13, 2021 at 07:17:13AM +0000, VAUTRIN Emmanuel (Canal Plus Prestataire) wrote:
> 
> ---
>  src/config.c           | 6 ++----
>  src/dnsproxy.c         | 2 +-
>  tools/ip6tables-test.c | 2 +-
>  tools/iptables-test.c  | 2 +-
>  4 files changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/src/config.c b/src/config.c
> index 62023b1072da..33fdc7375c15 100644
> --- a/src/config.c
> +++ b/src/config.c
> @@ -1106,8 +1106,7 @@ static char *config_pem_fsid(const char *pem_file)
>  
>  static void provision_service_wifi(struct connman_config_service *config,
>  				struct connman_service *service,
> -				struct connman_network *network,
> -				const void *ssid, unsigned int ssid_len)
> +				struct connman_network *network)
>  {
>  	if (config->eap)
>  		__connman_service_set_string(service, "EAP", config->eap);
> @@ -1418,8 +1417,7 @@ static int try_provision_service(struct connman_config_service *config,
>  						config->timeservers);
>  
>  	if (type == CONNMAN_SERVICE_TYPE_WIFI) {
> -		provision_service_wifi(config, service, network,
> -							ssid, ssid_len);
> +		provision_service_wifi(config, service, network);
>  	}
>  

Could you split this into cleanup patch with a commit message?

>  	__connman_service_mark_dirty();
> diff --git a/src/dnsproxy.c b/src/dnsproxy.c
> index 4b65b3790bb9..fbbee0413f8f 100644
> --- a/src/dnsproxy.c
> +++ b/src/dnsproxy.c
> @@ -2707,7 +2707,7 @@ static void update_domain(int index, const char *domain, bool append)
>  	for (list = server_list; list; list = list->next) {
>  		struct server_data *data = list->data;
>  		GList *dom_list;
> -		char *dom;
> +		char *dom = NULL;
>  		bool dom_found = false;
>  
>  		if (data->index < 0)


Same here (maybe including the compiler warning).

> diff --git a/tools/ip6tables-test.c b/tools/ip6tables-test.c
> index 41e842dd64af..a52f4af04edf 100644
> --- a/tools/ip6tables-test.c
> +++ b/tools/ip6tables-test.c
> @@ -45,7 +45,7 @@ int main(int argc, char *argv[])
>  {
>  	enum iptables_command cmd = IPTABLES_COMMAND_UNKNOWN;
>  	char *table = NULL, *chain = NULL, *rule = NULL, *tmp;
> -	int err, c, i;
> +	int err = -EINVAL, c, i;
>  
>  	opterr = 0;
>  
> diff --git a/tools/iptables-test.c b/tools/iptables-test.c
> index e9b7cb224d7a..f9d091eb9490 100644
> --- a/tools/iptables-test.c
> +++ b/tools/iptables-test.c
> @@ -44,7 +44,7 @@ int main(int argc, char *argv[])
>  {
>  	enum iptables_command cmd = IPTABLES_COMMAND_UNKNOWN;
>  	char *table = NULL, *chain = NULL, *rule = NULL, *tmp;
> -	int err, c, i;
> +	int err = -EINVAL, c, i;
>  
>  	opterr = 0;
>  
> -- 
> 2.25.1

For the tools/* fixes this is okay. Not really important stuff :)

Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] build: Fix compiler maybe-uninitialized warnings
  2021-09-13  7:27 ` Daniel Wagner
@ 2021-09-13  7:45   ` VAUTRIN Emmanuel (Canal Plus Prestataire)
  2021-09-20  7:22     ` Daniel Wagner
  0 siblings, 1 reply; 5+ messages in thread
From: VAUTRIN Emmanuel (Canal Plus Prestataire) @ 2021-09-13  7:45 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: connman

Hello Daniel,

> > -             provision_service_wifi(config, service, network,
> > -                                                     ssid, ssid_len);
> > +             provision_service_wifi(config, service, network);

> Could you split this into cleanup patch with a commit message?
In fact, all my modifications are fixes of maybe-uninitialized warnings. 
In this case, ssid is not initialized.
I thought title was explicit enough, what can I had in my comment?

> > +             char *dom = NULL;
> Same here (maybe including the compiler warning).
Do you really want to split patches even if they correspond to
the same activity (maybe-uninitialized warnings)?

> For the tools/* fixes this is okay. Not really important stuff :)
Indeed, just compilation stuff, I don't think it could have any
impact at usage, but it fixes the -Wall -Werror compilation.


Best Regards,

Emmanuel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] build: Fix compiler maybe-uninitialized warnings
  2021-09-13  7:45   ` VAUTRIN Emmanuel (Canal Plus Prestataire)
@ 2021-09-20  7:22     ` Daniel Wagner
  2021-09-20  8:15       ` VAUTRIN Emmanuel (Canal Plus Prestataire)
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Wagner @ 2021-09-20  7:22 UTC (permalink / raw)
  To: VAUTRIN Emmanuel (Canal Plus Prestataire); +Cc: connman

Hi Emmanuel,

On Mon, Sep 13, 2021 at 07:45:19AM +0000, VAUTRIN Emmanuel (Canal Plus Prestataire) wrote:
> > > -             provision_service_wifi(config, service, network,
> > > -                                                     ssid, ssid_len);
> > > +             provision_service_wifi(config, service, network);
> 
> > Could you split this into cleanup patch with a commit message?
> In fact, all my modifications are fixes of maybe-uninitialized warnings.

My compiler doesn't report them (gcc11). What compiler do you use and
what are the compile flags?

> In this case, ssid is not initialized.
> I thought title was explicit enough, what can I had in my comment?

Something like

"""
config: Remove unused arguments from provision_service_wifi()


gcc-10 complains with:

  ...

Remove the ssid and ssid_len argument from provision_service() as they
are not used.
"""

I know it's pretty obvious right now, but having ten commits in a row
with 'fix foo' and 'fix bar' without any explanation makes any 'git
blame' 'git log' operation really painful in two months from now. Been
there done that.

BTW, I tried to trigger the warnings and I was not able to. Now I am
trying to fix up clang compile errors...

Daniel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] build: Fix compiler maybe-uninitialized warnings
  2021-09-20  7:22     ` Daniel Wagner
@ 2021-09-20  8:15       ` VAUTRIN Emmanuel (Canal Plus Prestataire)
  0 siblings, 0 replies; 5+ messages in thread
From: VAUTRIN Emmanuel (Canal Plus Prestataire) @ 2021-09-20  8:15 UTC (permalink / raw)
  To: Daniel Wagner; +Cc: connman

Hi Daniel,
> My compiler doesn't report them (gcc11). What compiler do you use and
> what are the compile flags?
> (...)
> BTW, I tried to trigger the warnings and I was not able to. Now I am
> trying to fix up clang compile errors...
It is on clang-12 (with  -Wall -Werror,, in order to provide clean patches),
so you will probably face the problem. I let you finish your integration.
As said in the title, you can try the -Werror=maybe-uninitialized flag.

Best Regards,

Emmanuel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-20  8:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13  7:17 [PATCH] build: Fix compiler maybe-uninitialized warnings VAUTRIN Emmanuel (Canal Plus Prestataire)
2021-09-13  7:27 ` Daniel Wagner
2021-09-13  7:45   ` VAUTRIN Emmanuel (Canal Plus Prestataire)
2021-09-20  7:22     ` Daniel Wagner
2021-09-20  8:15       ` VAUTRIN Emmanuel (Canal Plus Prestataire)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).