linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func
@ 2012-08-28 13:33 Szymon Janc
  2012-08-28 13:33 ` [PATCH 2/2] Fix error reporting in sdp_service_search_attr_req Szymon Janc
  2012-08-28 17:30 ` [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Szymon Janc @ 2012-08-28 13:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Param data can't be NULL and was already dereferenced before check.

---
 src/sdp-xml.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/sdp-xml.c b/src/sdp-xml.c
index d7b2aef..52df285 100644
--- a/src/sdp-xml.c
+++ b/src/sdp-xml.c
@@ -377,10 +377,7 @@ static void convert_raw_attr_to_xml_func(void *val, void *data)
 		 value->attrId);
 	cd->appender(cd->data, buf);
 
-	if (data)
-		convert_raw_data_to_xml(value, 2, cd->data, cd->appender);
-	else
-		cd->appender(cd->data, "\t\tNULL\n");
+	convert_raw_data_to_xml(value, 2, cd->data, cd->appender);
 
 	cd->appender(cd->data, "\t</attribute>\n");
 }
-- 
1.7.9.5


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

* [PATCH 2/2] Fix error reporting in sdp_service_search_attr_req
  2012-08-28 13:33 [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func Szymon Janc
@ 2012-08-28 13:33 ` Szymon Janc
  2012-08-28 17:30 ` [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Szymon Janc @ 2012-08-28 13:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

This function reports error code via errno not return value.

---
 lib/sdp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/sdp.c b/lib/sdp.c
index 9807c8d..36b4d08 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -4346,7 +4346,8 @@ int sdp_service_search_attr_req(sdp_session_t *session, const sdp_list_t *search
 	seqlen = gen_attridseq_pdu(pdata, attrids,
 		reqtype == SDP_ATTR_REQ_INDIVIDUAL ? SDP_UINT16 : SDP_UINT32);
 	if (seqlen == -1) {
-		status = EINVAL;
+		errno = EINVAL;
+		status = -1;
 		goto end;
 	}
 	pdata += seqlen;
-- 
1.7.9.5


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

* Re: [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func
  2012-08-28 13:33 [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func Szymon Janc
  2012-08-28 13:33 ` [PATCH 2/2] Fix error reporting in sdp_service_search_attr_req Szymon Janc
@ 2012-08-28 17:30 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-08-28 17:30 UTC (permalink / raw)
  To: Szymon Janc; +Cc: linux-bluetooth

Hi Szymon,

On Tue, Aug 28, 2012, Szymon Janc wrote:
> Param data can't be NULL and was already dereferenced before check.
> 
> ---
>  src/sdp-xml.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Both patches have been applied. Thanks.

Johan

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

end of thread, other threads:[~2012-08-28 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-28 13:33 [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func Szymon Janc
2012-08-28 13:33 ` [PATCH 2/2] Fix error reporting in sdp_service_search_attr_req Szymon Janc
2012-08-28 17:30 ` [PATCH 1/2] Fix redundant NULL checks in convert_raw_attr_to_xml_func Johan Hedberg

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