linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] fix build
@ 2011-10-17 15:56 Frédéric Danis
  2011-10-17 16:00 ` Marcel Holtmann
  2011-10-18  8:19 ` Andrei Emeltchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Frédéric Danis @ 2011-10-17 15:56 UTC (permalink / raw)
  To: linux-bluetooth

src/eir.c: In function 'eir_parse':
src/eir.c:72: error: 'name_len' may be used uninitialized in this function

and

thermometer/thermometer.c: In function 'destroy_char':
thermometer/thermometer.c:79: error: implicit declaration of function 'g_slist_free_full'
---
 src/eir.c                 |    2 +-
 thermometer/thermometer.c |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/eir.c b/src/eir.c
index 8772191..8ada364 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -69,7 +69,7 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data)
 	uuid_t service;
 	char *uuid_str;
 	const char *name = NULL;
-	size_t name_len;
+	size_t name_len = 0;
 	unsigned int i;
 
 	eir->flags = -1;
diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
index 7621926..653ec76 100644
--- a/thermometer/thermometer.c
+++ b/thermometer/thermometer.c
@@ -20,6 +20,10 @@
  *
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <gdbus.h>
 #include <errno.h>
 #include <bluetooth/uuid.h>
@@ -34,6 +38,7 @@
 #include "att.h"
 #include "gatt.h"
 #include "thermometer.h"
+#include "glib-helper.h"
 
 #define THERMOMETER_INTERFACE "org.bluez.Thermometer"
 
-- 
1.7.1


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

* Re: [PATCH v3] fix build
  2011-10-17 15:56 [PATCH v3] fix build Frédéric Danis
@ 2011-10-17 16:00 ` Marcel Holtmann
  2011-10-18  8:19 ` Andrei Emeltchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2011-10-17 16:00 UTC (permalink / raw)
  To: Frédéric Danis; +Cc: linux-bluetooth

Hi Frederic,

> src/eir.c: In function 'eir_parse':
> src/eir.c:72: error: 'name_len' may be used uninitialized in this function
> 
> and
> 
> thermometer/thermometer.c: In function 'destroy_char':
> thermometer/thermometer.c:79: error: implicit declaration of function 'g_slist_free_full'

please split this into two patches.

The fix for thermometer/thermometer.c is fine, but for src/eir.c I think
it is better to rewrite that function with a more clean and simpler
version.

Regards

Marcel



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

* Re: [PATCH v3] fix build
  2011-10-17 15:56 [PATCH v3] fix build Frédéric Danis
  2011-10-17 16:00 ` Marcel Holtmann
@ 2011-10-18  8:19 ` Andrei Emeltchenko
  2011-10-18 16:36   ` Marcel Holtmann
  1 sibling, 1 reply; 5+ messages in thread
From: Andrei Emeltchenko @ 2011-10-18  8:19 UTC (permalink / raw)
  To: Frédéric Danis; +Cc: linux-bluetooth

On Mon, Oct 17, 2011 at 05:56:05PM +0200, Frédéric Danis wrote:
> src/eir.c: In function 'eir_parse':
> src/eir.c:72: error: 'name_len' may be used uninitialized in this function
> 
> and
> 
> thermometer/thermometer.c: In function 'destroy_char':
> thermometer/thermometer.c:79: error: implicit declaration of function 'g_slist_free_full'
> ---
>  src/eir.c                 |    2 +-
>  thermometer/thermometer.c |    5 +++++
>  2 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/src/eir.c b/src/eir.c
> index 8772191..8ada364 100644
> --- a/src/eir.c
> +++ b/src/eir.c
> @@ -69,7 +69,7 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data)
>  	uuid_t service;
>  	char *uuid_str;
>  	const char *name = NULL;
> -	size_t name_len;
> +	size_t name_len = 0;

BTW: shall we change build flags otherwise bluez is not building anymore.

make
make --no-print-directory all-am
  CC     src/eir.o
cc1: warnings being treated as errors
src/eir.c: In function ‘eir_parse’:
src/eir.c:73:9: error: ‘name_len’ may be used uninitialized in this
function
make[1]: *** [src/eir.o] Ошибка 1
make: *** [all] Ошибка 2

Best regards 
Andrei Emeltchenko 


>  	unsigned int i;
>  
>  	eir->flags = -1;
> diff --git a/thermometer/thermometer.c b/thermometer/thermometer.c
> index 7621926..653ec76 100644
> --- a/thermometer/thermometer.c
> +++ b/thermometer/thermometer.c
> @@ -20,6 +20,10 @@
>   *
>   */
>  
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
>  #include <gdbus.h>
>  #include <errno.h>
>  #include <bluetooth/uuid.h>
> @@ -34,6 +38,7 @@
>  #include "att.h"
>  #include "gatt.h"
>  #include "thermometer.h"
> +#include "glib-helper.h"
>  
>  #define THERMOMETER_INTERFACE "org.bluez.Thermometer"
>  
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v3] fix build
  2011-10-18  8:19 ` Andrei Emeltchenko
@ 2011-10-18 16:36   ` Marcel Holtmann
  2011-10-19  7:35     ` Andrei Emeltchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2011-10-18 16:36 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: Frédéric Danis, linux-bluetooth

Hi Andrei,

> > src/eir.c: In function 'eir_parse':
> > src/eir.c:72: error: 'name_len' may be used uninitialized in this function
> > 
> > and
> > 
> > thermometer/thermometer.c: In function 'destroy_char':
> > thermometer/thermometer.c:79: error: implicit declaration of function 'g_slist_free_full'
> > ---
> >  src/eir.c                 |    2 +-
> >  thermometer/thermometer.c |    5 +++++
> >  2 files changed, 6 insertions(+), 1 deletions(-)
> > 
> > diff --git a/src/eir.c b/src/eir.c
> > index 8772191..8ada364 100644
> > --- a/src/eir.c
> > +++ b/src/eir.c
> > @@ -69,7 +69,7 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data)
> >  	uuid_t service;
> >  	char *uuid_str;
> >  	const char *name = NULL;
> > -	size_t name_len;
> > +	size_t name_len = 0;
> 
> BTW: shall we change build flags otherwise bluez is not building anymore.
> 
> make
> make --no-print-directory all-am
>   CC     src/eir.o
> cc1: warnings being treated as errors
> src/eir.c: In function ‘eir_parse’:
> src/eir.c:73:9: error: ‘name_len’ may be used uninitialized in this
> function
> make[1]: *** [src/eir.o] Ошибка 1
> make: *** [all] Ошибка 2

it builds fine if you install a recent distro with a recent gcc.

Regards

Marcel



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

* Re: [PATCH v3] fix build
  2011-10-18 16:36   ` Marcel Holtmann
@ 2011-10-19  7:35     ` Andrei Emeltchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Emeltchenko @ 2011-10-19  7:35 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Frédéric Danis, linux-bluetooth

Hi Marcel,

On Tue, Oct 18, 2011 at 09:36:13AM -0700, Marcel Holtmann wrote:
> > > src/eir.c: In function 'eir_parse':
> > > src/eir.c:72: error: 'name_len' may be used uninitialized in this function
> > > 
> > > and
> > > 
> > > thermometer/thermometer.c: In function 'destroy_char':
> > > thermometer/thermometer.c:79: error: implicit declaration of function 'g_slist_free_full'
> > > ---
> > >  src/eir.c                 |    2 +-
> > >  thermometer/thermometer.c |    5 +++++
> > >  2 files changed, 6 insertions(+), 1 deletions(-)
> > > 
> > > diff --git a/src/eir.c b/src/eir.c
> > > index 8772191..8ada364 100644
> > > --- a/src/eir.c
> > > +++ b/src/eir.c
> > > @@ -69,7 +69,7 @@ int eir_parse(struct eir_data *eir, uint8_t *eir_data)
> > >  	uuid_t service;
> > >  	char *uuid_str;
> > >  	const char *name = NULL;
> > > -	size_t name_len;
> > > +	size_t name_len = 0;
> > 
> > BTW: shall we change build flags otherwise bluez is not building anymore.
> > 
> > make
> > make --no-print-directory all-am
> >   CC     src/eir.o
> > cc1: warnings being treated as errors
> > src/eir.c: In function ‘eir_parse’:
> > src/eir.c:73:9: error: ‘name_len’ may be used uninitialized in this
> > function
> > make[1]: *** [src/eir.o] Ошибка 1
> > make: *** [all] Ошибка 2
> 
> it builds fine if you install a recent distro with a recent gcc.

What is the recent gcc I need to have? I have Ubuntu 11.04 with gcc:

gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

Actually several weeks ago new Ubuntu was introduced 11.10, hopefully they
have right gcc :-)

Best regards 
Andrei Emeltchenko 

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

end of thread, other threads:[~2011-10-19  7:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-17 15:56 [PATCH v3] fix build Frédéric Danis
2011-10-17 16:00 ` Marcel Holtmann
2011-10-18  8:19 ` Andrei Emeltchenko
2011-10-18 16:36   ` Marcel Holtmann
2011-10-19  7:35     ` Andrei Emeltchenko

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).