linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Cc: Bastien Nocera <hadess@hadess.net>
Subject: [PATCH 7/8] android/hal-bluetooth: Fix unaligned struct access
Date: Thu,  9 May 2019 14:37:45 +0200	[thread overview]
Message-ID: <20190509123746.8396-7-hadess@hadess.net> (raw)
In-Reply-To: <20190509123746.8396-1-hadess@hadess.net>

android/hal-bluetooth.c: In function ‘set_adapter_property’:
android/hal-bluetooth.c:659:46: error: taking address of packed member of ‘struct hal_cmd_set_adapter_prop’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
  659 |  adapter_prop_from_hal(property, &cmd->type, &cmd->len, cmd->val);
      |                                              ^~~~~~~~~
---
 android/hal-bluetooth.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c
index f22801b04..ee3a5e054 100644
--- a/android/hal-bluetooth.c
+++ b/android/hal-bluetooth.c
@@ -649,6 +649,7 @@ static int set_adapter_property(const bt_property_t *property)
 {
 	char buf[IPC_MTU];
 	struct hal_cmd_set_adapter_prop *cmd = (void *) buf;
+	uint16_t len_ret;
 	size_t len;
 
 	DBG("prop: %s", btproperty2str(property));
@@ -656,8 +657,9 @@ static int set_adapter_property(const bt_property_t *property)
 	if (!interface_ready())
 		return BT_STATUS_NOT_READY;
 
-	adapter_prop_from_hal(property, &cmd->type, &cmd->len, cmd->val);
+	adapter_prop_from_hal(property, &cmd->type, &len_ret, cmd->val);
 
+	cmd->len = len_ret;
 	len = sizeof(*cmd) + cmd->len;
 
 	return hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_SET_ADAPTER_PROP,
-- 
2.21.0


  parent reply	other threads:[~2019-05-09 12:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 12:37 [PATCH 1/8] build: Add a few default configure options Bastien Nocera
2019-05-09 12:37 ` [PATCH 2/8] build: Add warnings for non-literal strings Bastien Nocera
2019-05-09 12:37 ` [PATCH 3/8] build: Enable BIND_NOW Bastien Nocera
2019-05-09 12:37 ` [PATCH 4/8] tools/csr_usb: Fix compilation failure Bastien Nocera
2019-05-09 12:37 ` [PATCH 5/8] obex: Work-around " Bastien Nocera
2019-05-09 12:37 ` [PATCH 6/8] android/avrcp-lib: Fix unaligned struct access Bastien Nocera
2019-05-09 12:37 ` Bastien Nocera [this message]
2019-05-09 12:37 ` [PATCH 8/8] android/handsfree: " Bastien Nocera
2019-05-13 17:38 ` [PATCH 1/8] build: Add a few default configure options Luiz Augusto von Dentz
2019-05-13 18:13   ` Bastien Nocera

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=20190509123746.8396-7-hadess@hadess.net \
    --to=hadess@hadess.net \
    --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;
as well as URLs for NNTP newsgroup(s).