[RFC BlueZ 10/18] attrib: Allow dec_read_resp() to just check if PDU is valid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a NULL "value" parameter is given, only check whether PDU is valid,
without copying attribute value to a buffer.
---
 attrib/att.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/attrib/att.c b/attrib/att.c
index d2b78bd..14871d9 100644
--- a/attrib/att.c
+++ b/attrib/att.c
@@ -703,12 +703,12 @@ ssize_t dec_read_resp(const uint8_t *pdu, size_t len, uint8_t *value, size_t vle
 	if (pdu == NULL)
 		return -EINVAL;
 
-	if (value == NULL)
-		return -EINVAL;
-
 	if (pdu[0] != ATT_OP_READ_RESP)
 		return -EINVAL;
 
+	if (value == NULL)
+		return len - 1;
+
 	if (vlen < (len - 1))
 		return -ENOBUFS;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux