diff options
author | Markus Armbruster <armbru@redhat.com> | 2013-01-16 14:50:28 +0100 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2013-01-19 10:22:44 +0000 |
commit | 089da572b956ef0f8f5b8d5917358e07892a77c2 (patch) | |
tree | 3bcc9c8123e3e21e6645eaa63e97914447e9e25c /hw/fw_cfg.h | |
parent | b3dd15529de22cd4bcedb6344105e87878d971b6 (diff) |
fw_cfg: Use void *, size_t instead of uint8_t *, uint32_t for blobs
Many callers pass size_t, which gets silently truncated to uint32_t.
Harmless, because all practical sizes are well below 4GiB. Clean it
up anyway. Size overflow now fails assertions.
Bonus: saves a whole bunch of silly casts.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/fw_cfg.h')
-rw-r--r-- | hw/fw_cfg.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h index c2c57cd2aa..05c8df186f 100644 --- a/hw/fw_cfg.h +++ b/hw/fw_cfg.h @@ -54,15 +54,15 @@ typedef struct FWCfgFiles { typedef void (*FWCfgCallback)(void *opaque, uint8_t *data); typedef struct FWCfgState FWCfgState; -void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len); +void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len); void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value); void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value); void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value); void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value); void fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback, - void *callback_opaque, uint8_t *data, size_t len); -void fw_cfg_add_file(FWCfgState *s, const char *filename, uint8_t *data, - uint32_t len); + void *callback_opaque, void *data, size_t len); +void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data, + size_t len); FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, hwaddr crl_addr, hwaddr data_addr); |