* [PATCH 1/1] Fixes sdp_get_supp_feat function
@ 2010-05-14 3:13 Elvis Pfützenreuter
2010-05-14 7:02 ` José Antonio Santos Cadenas
0 siblings, 1 reply; 4+ messages in thread
From: Elvis Pfützenreuter @ 2010-05-14 3:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: epx
In case of string data items, value is a pointer by itself.
---
lib/sdp.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/lib/sdp.c b/lib/sdp.c
index fb8ccdc..c75a000 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -4801,10 +4801,15 @@ int sdp_get_supp_feat(const sdp_record_t *rec, sdp_list_t **seqp)
subseq = NULL;
for (dd = d->val.dataseq; dd; dd = dd->next) {
sdp_data_t *data;
+ void *val;
if (dd->dtd != SDP_UINT8 && dd->dtd != SDP_UINT16 &&
dd->dtd != SDP_TEXT_STR8)
goto fail;
- data = sdp_data_alloc(dd->dtd, &dd->val);
+ if (dd->dtd == SDP_TEXT_STR8)
+ val = dd->val.str;
+ else
+ val = &dd->val;
+ data = sdp_data_alloc(dd->dtd, val);
if (data)
subseq = sdp_list_append(subseq, data);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Fixes sdp_get_supp_feat function
2010-05-14 3:13 [PATCH 1/1] Fixes sdp_get_supp_feat function Elvis Pfützenreuter
@ 2010-05-14 7:02 ` José Antonio Santos Cadenas
2010-05-14 12:58 ` Elvis Pfützenreuter
0 siblings, 1 reply; 4+ messages in thread
From: José Antonio Santos Cadenas @ 2010-05-14 7:02 UTC (permalink / raw)
To: Elvis Pfützenreuter; +Cc: linux-bluetooth
Hi Elvis,
El Friday 14 May 2010 05:13:30 Elvis Pfützenreuter escribió:
> In case of string data items, value is a pointer by itself.
> ---
> lib/sdp.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/lib/sdp.c b/lib/sdp.c
> index fb8ccdc..c75a000 100644
> --- a/lib/sdp.c
> +++ b/lib/sdp.c
> @@ -4801,10 +4801,15 @@ int sdp_get_supp_feat(const sdp_record_t *rec,
> sdp_list_t **seqp) subseq = NULL;
> for (dd = d->val.dataseq; dd; dd = dd->next) {
> sdp_data_t *data;
> + void *val;
> if (dd->dtd != SDP_UINT8 && dd->dtd != SDP_UINT16 &&
> dd->dtd != SDP_TEXT_STR8)
> goto fail;
> - data = sdp_data_alloc(dd->dtd, &dd->val);
> + if (dd->dtd == SDP_TEXT_STR8)
> + val = dd->val.str;
> + else
> + val = &dd->val;
> + data = sdp_data_alloc(dd->dtd, val);
No only strings are pointers, if you see this patch:
http://git.kernel.org/?p=bluetooth/bluez.git;a=commit;h=1d1154156df28660e41031df5c3f1ffe91c01aae
that I sent few days ago for fixing the set function, also sequences are
pointers and should be treated in a different way. Also strings can be formed
by other types not only SDP_TEXT_STR8. I think a switch will fix this better.
> if (data)
> subseq = sdp_list_append(subseq, data);
> }
Regards.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Fixes sdp_get_supp_feat function
2010-05-14 7:02 ` José Antonio Santos Cadenas
@ 2010-05-14 12:58 ` Elvis Pfützenreuter
2010-05-14 14:50 ` José Antonio Santos Cadenas
0 siblings, 1 reply; 4+ messages in thread
From: Elvis Pfützenreuter @ 2010-05-14 12:58 UTC (permalink / raw)
To: jcaden; +Cc: linux-bluetooth
On 14/05/2010, at 04:02, José Antonio Santos Cadenas wrote:
> Hi Elvis,
>
> El Friday 14 May 2010 05:13:30 Elvis Pfützenreuter escribió:
>> In case of string data items, value is a pointer by itself.
>> ---
>> lib/sdp.c | 7 ++++++-
>> 1 files changed, 6 insertions(+), 1 deletions(-)
>>
>> diff --git a/lib/sdp.c b/lib/sdp.c
>> index fb8ccdc..c75a000 100644
>> --- a/lib/sdp.c
>> +++ b/lib/sdp.c
>> @@ -4801,10 +4801,15 @@ int sdp_get_supp_feat(const sdp_record_t *rec,
>> sdp_list_t **seqp) subseq = NULL;
>> for (dd = d->val.dataseq; dd; dd = dd->next) {
>> sdp_data_t *data;
>> + void *val;
>> if (dd->dtd != SDP_UINT8 && dd->dtd != SDP_UINT16 &&
>> dd->dtd != SDP_TEXT_STR8)
>> goto fail;
>> - data = sdp_data_alloc(dd->dtd, &dd->val);
>> + if (dd->dtd == SDP_TEXT_STR8)
>> + val = dd->val.str;
>> + else
>> + val = &dd->val;
>> + data = sdp_data_alloc(dd->dtd, val);
>
> No only strings are pointers, if you see this patch:
> http://git.kernel.org/?p=bluetooth/bluez.git;a=commit;h=1d1154156df28660e41031df5c3f1ffe91c01aae
>
> that I sent few days ago for fixing the set function, also sequences are
> pointers and should be treated in a different way. Also strings can be formed
> by other types not only SDP_TEXT_STR8. I think a switch will fix this better.
That would be nice for completeness, but the if .. goto fail just before the patch guarantees that data type will be UINT8, UINT16 or an STR8. (Am I missing something here?)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] Fixes sdp_get_supp_feat function
2010-05-14 12:58 ` Elvis Pfützenreuter
@ 2010-05-14 14:50 ` José Antonio Santos Cadenas
0 siblings, 0 replies; 4+ messages in thread
From: José Antonio Santos Cadenas @ 2010-05-14 14:50 UTC (permalink / raw)
To: Elvis Pfützenreuter; +Cc: linux-bluetooth
Hi,
El Friday 14 May 2010 14:58:00 Elvis Pfützenreuter escribió:
>
> On 14/05/2010, at 04:02, José Antonio Santos Cadenas wrote:
>
> > Hi Elvis,
> >
> > El Friday 14 May 2010 05:13:30 Elvis Pfützenreuter escribió:
> >> In case of string data items, value is a pointer by itself.
> >> ---
> >> lib/sdp.c | 7 ++++++-
> >> 1 files changed, 6 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/lib/sdp.c b/lib/sdp.c
> >> index fb8ccdc..c75a000 100644
> >> --- a/lib/sdp.c
> >> +++ b/lib/sdp.c
> >> @@ -4801,10 +4801,15 @@ int sdp_get_supp_feat(const sdp_record_t *rec,
> >> sdp_list_t **seqp) subseq = NULL;
> >> for (dd = d->val.dataseq; dd; dd = dd->next) {
> >> sdp_data_t *data;
> >> + void *val;
> >> if (dd->dtd != SDP_UINT8 && dd->dtd != SDP_UINT16 &&
> >> dd->dtd != SDP_TEXT_STR8)
> >> goto fail;
> >> - data = sdp_data_alloc(dd->dtd, &dd->val);
> >> + if (dd->dtd == SDP_TEXT_STR8)
> >> + val = dd->val.str;
> >> + else
> >> + val = &dd->val;
> >> + data = sdp_data_alloc(dd->dtd, val);
> >
> > No only strings are pointers, if you see this patch:
> > http://git.kernel.org/?p=bluetooth/bluez.git;a=commit;h=1d1154156df28660e41031df5c3f1ffe91c01aae
> >
> > that I sent few days ago for fixing the set function, also sequences are
> > pointers and should be treated in a different way. Also strings can be formed
> > by other types not only SDP_TEXT_STR8. I think a switch will fix this better.
>
> That would be nice for completeness, but the if .. goto fail just before the patch guarantees that data type will be UINT8, UINT16 or an STR8. (Am I missing something here?)
Of course, the code seems to work fine. I just suggested to modify it at once, because a
"bug"/non completeness is still there and another patch will be required. It's a little
bit more of work and the code will work in all the cases.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-14 14:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-14 3:13 [PATCH 1/1] Fixes sdp_get_supp_feat function Elvis Pfützenreuter
2010-05-14 7:02 ` José Antonio Santos Cadenas
2010-05-14 12:58 ` Elvis Pfützenreuter
2010-05-14 14:50 ` José Antonio Santos Cadenas
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).