* [PATCH 1/4] android/haltest: Remove unneeded assignment
@ 2014-02-07 12:11 Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 2/4] avdtp: Fix passing NULL pointer to memcpy Andrei Emeltchenko
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2014-02-07 12:11 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/client/if-audio.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/android/client/if-audio.c b/android/client/if-audio.c
index 8c640a1..5ab11a6 100644
--- a/android/client/if-audio.c
+++ b/android/client/if-audio.c
@@ -225,10 +225,8 @@ static void *playback_thread(void *data)
pthread_mutex_unlock(&outstream_mutex);
} while (len && w_len > 0);
- if (in) {
+ if (in)
fclose(in);
- in = NULL;
- }
pthread_cleanup_pop(1);
return NULL;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] avdtp: Fix passing NULL pointer to memcpy
2014-02-07 12:11 [PATCH 1/4] android/haltest: Remove unneeded assignment Andrei Emeltchenko
@ 2014-02-07 12:11 ` Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 3/4] " Andrei Emeltchenko
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2014-02-07 12:11 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
send_request can be called as
send_request(session, FALSE, NULL, AVDTP_DISCOVER, NULL, 0) with NULL
pointer which is passed to memcpy().
---
profiles/audio/avdtp.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index fbf61f0..da10ab4 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2731,11 +2731,14 @@ static int send_request(struct avdtp *session, gboolean priority,
req = g_new0(struct pending_req, 1);
req->signal_id = signal_id;
- req->data = g_malloc(size);
- memcpy(req->data, buffer, size);
- req->data_size = size;
req->stream = stream;
+ if (buffer && size) {
+ req->data = g_malloc(size);
+ memcpy(req->data, buffer, size);
+ req->data_size = size;
+ }
+
return send_req(session, priority, req);
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] avdtp: Fix passing NULL pointer to memcpy
2014-02-07 12:11 [PATCH 1/4] android/haltest: Remove unneeded assignment Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 2/4] avdtp: Fix passing NULL pointer to memcpy Andrei Emeltchenko
@ 2014-02-07 12:11 ` Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 4/4] bnep: Calculate ifindex after NULL check Andrei Emeltchenko
2014-02-10 12:16 ` [PATCH 1/4] android/haltest: Remove unneeded assignment Luiz Augusto von Dentz
3 siblings, 0 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2014-02-07 12:11 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The patch fixes following clang warning:
...
profiles/audio/avdtp.c:3293:2: warning: Null pointer passed as an
argument to a 'nonnull' parameter
memcpy(cap->data, data, length);
^ ~~~~
1 warning generated.
...
---
profiles/audio/avdtp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index da10ab4..b7ddb6c 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -3290,7 +3290,9 @@ struct avdtp_service_capability *avdtp_service_cap_new(uint8_t category,
cap = g_malloc(sizeof(struct avdtp_service_capability) + length);
cap->category = category;
cap->length = length;
- memcpy(cap->data, data, length);
+
+ if (data)
+ memcpy(cap->data, data, length);
return cap;
}
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] bnep: Calculate ifindex after NULL check
2014-02-07 12:11 [PATCH 1/4] android/haltest: Remove unneeded assignment Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 2/4] avdtp: Fix passing NULL pointer to memcpy Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 3/4] " Andrei Emeltchenko
@ 2014-02-07 12:11 ` Andrei Emeltchenko
2014-02-10 12:16 ` [PATCH 1/4] android/haltest: Remove unneeded assignment Luiz Augusto von Dentz
3 siblings, 0 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2014-02-07 12:11 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
profiles/network/bnep.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c
index 1aa0783..ece979f 100644
--- a/profiles/network/bnep.c
+++ b/profiles/network/bnep.c
@@ -523,13 +523,15 @@ static int bnep_add_to_bridge(const char *devname, const char *bridge)
static int bnep_del_from_bridge(const char *devname, const char *bridge)
{
- int ifindex = if_nametoindex(devname);
+ int ifindex;
struct ifreq ifr;
int sk, err;
if (!devname || !bridge)
return -EINVAL;
+ ifindex = if_nametoindex(devname);
+
sk = socket(AF_INET, SOCK_STREAM, 0);
if (sk < 0)
return -1;
--
1.8.3.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] android/haltest: Remove unneeded assignment
2014-02-07 12:11 [PATCH 1/4] android/haltest: Remove unneeded assignment Andrei Emeltchenko
` (2 preceding siblings ...)
2014-02-07 12:11 ` [PATCH 4/4] bnep: Calculate ifindex after NULL check Andrei Emeltchenko
@ 2014-02-10 12:16 ` Luiz Augusto von Dentz
2014-02-13 8:21 ` Andrei Emeltchenko
3 siblings, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2014-02-10 12:16 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth@vger.kernel.org
Hi Andrei,
On Fri, Feb 7, 2014 at 2:11 PM, Andrei Emeltchenko
<Andrei.Emeltchenko.news@gmail.com> wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> ---
> android/client/if-audio.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/android/client/if-audio.c b/android/client/if-audio.c
> index 8c640a1..5ab11a6 100644
> --- a/android/client/if-audio.c
> +++ b/android/client/if-audio.c
> @@ -225,10 +225,8 @@ static void *playback_thread(void *data)
> pthread_mutex_unlock(&outstream_mutex);
> } while (len && w_len > 0);
>
> - if (in) {
> + if (in)
> fclose(in);
> - in = NULL;
> - }
>
> pthread_cleanup_pop(1);
> return NULL;
> --
> 1.8.3.2
Pushed, note that I did move the changes from audio to android since
the audio code will be dropped as it is not unit tested.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/4] android/haltest: Remove unneeded assignment
2014-02-10 12:16 ` [PATCH 1/4] android/haltest: Remove unneeded assignment Luiz Augusto von Dentz
@ 2014-02-13 8:21 ` Andrei Emeltchenko
0 siblings, 0 replies; 6+ messages in thread
From: Andrei Emeltchenko @ 2014-02-13 8:21 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org
Hi Luiz,
On Mon, Feb 10, 2014 at 02:16:09PM +0200, Luiz Augusto von Dentz wrote:
> Hi Andrei,
>
> On Fri, Feb 7, 2014 at 2:11 PM, Andrei Emeltchenko
> <Andrei.Emeltchenko.news@gmail.com> wrote:
> > From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> >
> > ---
> > android/client/if-audio.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/android/client/if-audio.c b/android/client/if-audio.c
> > index 8c640a1..5ab11a6 100644
> > --- a/android/client/if-audio.c
> > +++ b/android/client/if-audio.c
> > @@ -225,10 +225,8 @@ static void *playback_thread(void *data)
> > pthread_mutex_unlock(&outstream_mutex);
> > } while (len && w_len > 0);
> >
> > - if (in) {
> > + if (in)
> > fclose(in);
> > - in = NULL;
> > - }
> >
> > pthread_cleanup_pop(1);
> > return NULL;
> > --
> > 1.8.3.2
>
> Pushed, note that I did move the changes from audio to android since
> the audio code will be dropped as it is not unit tested.
I still think that those patches needs to applied otherwise we have
following warnings:
...
CC profiles/audio/bluetoothd-avdtp.o
profiles/audio/avdtp.c:2735:2: warning: Null pointer passed as an argument
to a 'nonnull' parameter
memcpy(req->data, buffer, size);
^ ~~~~~~
profiles/audio/avdtp.c:3290:2: warning: Null pointer passed as an argument
to a 'nonnull' parameter
memcpy(cap->data, data, length);
^ ~~~~
2 warnings generated.
...
You may choose to fix those warns other ways though.
Best regards
Andrei Emeltchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-13 8:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-07 12:11 [PATCH 1/4] android/haltest: Remove unneeded assignment Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 2/4] avdtp: Fix passing NULL pointer to memcpy Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 3/4] " Andrei Emeltchenko
2014-02-07 12:11 ` [PATCH 4/4] bnep: Calculate ifindex after NULL check Andrei Emeltchenko
2014-02-10 12:16 ` [PATCH 1/4] android/haltest: Remove unneeded assignment Luiz Augusto von Dentz
2014-02-13 8:21 ` Andrei Emeltchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox