android/hal-bluetooth: Fix unaligned struct access
authorBastien Nocera <hadess@hadess.net>
Thu, 9 May 2019 12:37:45 +0000 (14:37 +0200)
committerhimanshu <h.himanshu@samsung.com>
Tue, 11 Feb 2020 08:57:47 +0000 (14:27 +0530)
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);
      |                                              ^~~~~~~~~

Change-Id: Ic6714f8657c5f7f6f7a72a7aaaff26fcb63d93f5
Signed-off-by: himanshu <h.himanshu@samsung.com>
android/hal-bluetooth.c

index 66f4a37..8212243 100755 (executable)
@@ -648,6 +648,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));
@@ -655,8 +656,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,