mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-15 02:54:47 +00:00
synaptics-rmi: Fix the packing of the partition table
The data was part of the union, not the struct. It's also binary format and thus needs to be packed.
This commit is contained in:
parent
63aa6759f0
commit
e87abd81a2
@ -381,14 +381,15 @@ fu_synaptics_rmi_v7_device_read_blocks (FuSynapticsRmiDevice *self,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct __attribute__((packed)) {
|
||||||
guint16 partition_id;
|
guint16 partition_id;
|
||||||
guint16 partition_len;
|
guint16 partition_len;
|
||||||
guint16 partition_addr;
|
guint16 partition_addr;
|
||||||
guint16 partition_prop;
|
guint16 partition_prop;
|
||||||
guint16 data[8];
|
|
||||||
} RmiPartitionTbl;
|
} RmiPartitionTbl;
|
||||||
|
|
||||||
|
G_STATIC_ASSERT(sizeof(RmiPartitionTbl) == 8);
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
fu_synaptics_rmi_device_read_flash_config_v7 (FuSynapticsRmiDevice *self, GError **error)
|
fu_synaptics_rmi_device_read_flash_config_v7 (FuSynapticsRmiDevice *self, GError **error)
|
||||||
{
|
{
|
||||||
@ -464,7 +465,7 @@ fu_synaptics_rmi_device_read_flash_config_v7 (FuSynapticsRmiDevice *self, GError
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parse the config length */
|
/* parse the config length */
|
||||||
for (guint i = 0x2; i < buf_sz; i = i + 0x8) {
|
for (guint i = 0x2; i < buf_sz; i += sizeof(RmiPartitionTbl)) {
|
||||||
RmiPartitionTbl tbl;
|
RmiPartitionTbl tbl;
|
||||||
if (!fu_memcpy_safe ((guint8 *) &tbl, sizeof(tbl), 0x0, /* dst */
|
if (!fu_memcpy_safe ((guint8 *) &tbl, sizeof(tbl), 0x0, /* dst */
|
||||||
buf, buf_sz, i, /* src */
|
buf, buf_sz, i, /* src */
|
||||||
|
Loading…
Reference in New Issue
Block a user