Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [RFC 08/14] android: Remove not needed buf len from Core service functions
Date: Wed, 6 Nov 2013 15:09:24 +0100	[thread overview]
Message-ID: <1383746970-25906-9-git-send-email-szymon.janc@tieto.com> (raw)
In-Reply-To: <1383746970-25906-1-git-send-email-szymon.janc@tieto.com>

Message correctness is verified upon reception and handling functions
can simply make assumption that data in buffer is correct.
---
 android/main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/android/main.c b/android/main.c
index 85ea270..d7e77a2 100644
--- a/android/main.c
+++ b/android/main.c
@@ -76,7 +76,7 @@ static GIOChannel *hal_notif_io = NULL;
 
 static bool services[HAL_SERVICE_ID_MAX + 1] = { false };
 
-static void service_register(void *buf, uint16_t len)
+static void service_register(void *buf)
 {
 	struct hal_cmd_register_module *m = buf;
 	const bdaddr_t *adapter_bdaddr = bt_adapter_get_address();
@@ -126,7 +126,7 @@ failed:
 	ipc_send_rsp(hal_cmd_io, HAL_SERVICE_ID_CORE, HAL_STATUS_FAILED);
 }
 
-static void service_unregister(void *buf, uint16_t len)
+static void service_unregister(void *buf)
 {
 	struct hal_cmd_unregister_module *m = buf;
 
@@ -167,14 +167,14 @@ failed:
 	ipc_send_rsp(hal_cmd_io, HAL_SERVICE_ID_CORE, HAL_STATUS_FAILED);
 }
 
-static void handle_service_core(uint8_t opcode, void *buf, uint16_t len)
+static void handle_service_core(uint8_t opcode, void *buf)
 {
 	switch (opcode) {
 	case HAL_OP_REGISTER_MODULE:
-		service_register(buf, len);
+		service_register(buf);
 		break;
 	case HAL_OP_UNREGISTER_MODULE:
-		service_unregister(buf, len);
+		service_unregister(buf);
 		break;
 	default:
 		ipc_send_rsp(hal_cmd_io, HAL_SERVICE_ID_CORE,
@@ -246,7 +246,7 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
 
 	switch (msg->service_id) {
 	case HAL_SERVICE_ID_CORE:
-		handle_service_core(msg->opcode, buf + sizeof(*msg), msg->len);
+		handle_service_core(msg->opcode, buf + sizeof(*msg));
 		break;
 	case HAL_SERVICE_ID_BLUETOOTH:
 		bt_adapter_handle_cmd(hal_cmd_io, msg->opcode, msg->payload,
-- 
1.8.4.2


  parent reply	other threads:[~2013-11-06 14:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 14:09 [RFC 00/14] IPC sanity checks Szymon Janc
2013-11-06 14:09 ` [RFC 01/14] android: Add HAL IPC commands sanity check Szymon Janc
2013-11-07  8:44   ` Johan Hedberg
2013-11-06 14:09 ` [RFC 02/14] android: Use IPC command sanity checks Szymon Janc
2013-11-06 14:09 ` [RFC 03/14] android: Add HAL IPC message response " Szymon Janc
2013-11-06 14:09 ` [RFC 04/14] android/hal: Use IPC command responses " Szymon Janc
2013-11-06 14:09 ` [RFC 05/14] android: Add HAL IPC events sanity check Szymon Janc
2013-11-06 14:09 ` [RFC 06/14] android/hal: Use IPC notifications sanity checks Szymon Janc
2013-11-06 14:09 ` [RFC 07/14] android: Remove not needed HAL_MINIMUM_EVENT define Szymon Janc
2013-11-06 14:09 ` Szymon Janc [this message]
2013-11-06 14:09 ` [RFC 09/14] android: Remove not needed buf len from Bluetooth service functions Szymon Janc
2013-11-06 14:09 ` [RFC 10/14] android: Remove not needed buf len from Hidhost " Szymon Janc
2013-11-06 14:09 ` [RFC 11/14] android: Remove not needed buf len from Socket " Szymon Janc
2013-11-06 14:09 ` [RFC 12/14] android/hal: Remove not neede buf len from bluetooth HAL Szymon Janc
2013-11-06 14:09 ` [RFC 13/14] android/hal: Remove not neede buf len from hidhost HAL Szymon Janc
2013-11-06 14:09 ` [RFC 14/14] android/hal: Remove not neede buf len from av HAL Szymon Janc

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=1383746970-25906-9-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.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