Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] android/avrcp: Fix passing wrong len
Date: Tue, 25 Feb 2014 15:47:38 +0200	[thread overview]
Message-ID: <1393336058-431-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

When handling vendor dependent pdus len was passed in wrong order to
callback.
---
 android/avrcp-lib.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index c78881f..c280cf8 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -128,14 +128,14 @@ static size_t handle_vendordep_pdu(struct avctp *conn, uint8_t transaction,
 	const struct avrcp_control_handler *handler;
 	struct avrcp_header *pdu = (void *) operands;
 	uint32_t company_id = ntoh24(pdu->company_id);
+	uint16_t params_len = ntohs(pdu->params_len);
 
 	if (company_id != IEEEID_BTSIG) {
 		*code = AVC_CTYPE_NOT_IMPLEMENTED;
 		return 0;
 	}
 
-	DBG("AVRCP PDU 0x%02X, len 0x%04X", pdu->pdu_id,
-						ntohs(pdu->params_len));
+	DBG("AVRCP PDU 0x%02X, len 0x%04X", pdu->pdu_id, params_len);
 
 	pdu->packet_type = 0;
 	pdu->rsvd = 0;
@@ -163,10 +163,10 @@ static size_t handle_vendordep_pdu(struct avctp *conn, uint8_t transaction,
 		goto reject;
 	}
 
-	*code = handler->func(session, transaction, &pdu->params_len,
+	*code = handler->func(session, transaction, &params_len,
 					pdu->params, session->control_data);
 
-	return AVRCP_HEADER_LENGTH + ntohs(pdu->params_len);
+	return AVRCP_HEADER_LENGTH + params_len;
 
 reject:
 	pdu->params_len = htons(1);
-- 
1.8.3.2


             reply	other threads:[~2014-02-25 13:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25 13:47 Andrei Emeltchenko [this message]
2014-02-25 14:09 ` [PATCH] android/avrcp: Fix passing wrong len Luiz Augusto von Dentz
2014-02-26 12:40   ` [PATCHv2] " Andrei Emeltchenko
2014-02-26 17:27     ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1393336058-431-1-git-send-email-Andrei.Emeltchenko.news@gmail.com \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox