Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47bee278 authored by Zach Johnson's avatar Zach Johnson
Browse files

Don't pack and align GATT structs

Causes BUS_ADRALEN on some architectures.

Change-Id: I50c2e1b4ef81fa8cd223cba09285099da8d7f67d
Fixes: 70571956
Test: 100% repro on bug before change, retest and 0% repro
parent 2cc19163
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ tBTA_GATTC_CHARACTERISTIC* bta_gattc_get_characteristic_srcb(
#define BTA_GATT_SDP_DB_SIZE 4096

#define GATT_CACHE_PREFIX "/data/misc/bluetooth/gatt_cache_"
#define GATT_CACHE_VERSION 3
#define GATT_CACHE_VERSION 4

static void bta_gattc_generate_cache_file_name(char* buffer, size_t buffer_len,
                                               const RawAddress& bda) {
+5 −5
Original line number Diff line number Diff line
@@ -378,7 +378,7 @@ struct tBTA_GATTC_CHARACTERISTIC;
struct tBTA_GATTC_DESCRIPTOR;
struct tBTA_GATTC_INCLUDED_SVC;

typedef struct {
struct tBTA_GATTC_SERVICE {
  bluetooth::Uuid uuid;
  bool is_primary;
  uint16_t handle;
@@ -386,7 +386,7 @@ typedef struct {
  uint16_t e_handle;
  std::vector<tBTA_GATTC_CHARACTERISTIC> characteristics;
  std::vector<tBTA_GATTC_INCLUDED_SVC> included_svc;
} __attribute__((packed, aligned(alignof(bluetooth::Uuid)))) tBTA_GATTC_SERVICE;
};

struct tBTA_GATTC_CHARACTERISTIC {
  bluetooth::Uuid uuid;
@@ -395,19 +395,19 @@ struct tBTA_GATTC_CHARACTERISTIC {
  uint16_t value_handle;
  tGATT_CHAR_PROP properties;
  std::vector<tBTA_GATTC_DESCRIPTOR> descriptors;
} __attribute__((packed, aligned(alignof(bluetooth::Uuid))));
};

struct tBTA_GATTC_DESCRIPTOR {
  bluetooth::Uuid uuid;
  uint16_t handle;
} __attribute__((packed));
};

struct tBTA_GATTC_INCLUDED_SVC {
  bluetooth::Uuid uuid;
  uint16_t handle;
  tBTA_GATTC_SERVICE* owning_service; /* owning service*/
  tBTA_GATTC_SERVICE* included_service;
} __attribute__((packed));
};

/*****************************************************************************
 *  External Function Declarations