qemu-e2k/hw
Marc-André Lureau cc1b6c5533 tpm: fix alignment issues
The new tpm-crb-test fails on sparc host:

TEST: tests/tpm-crb-test... (pid=230409)
  /i386/tpm-crb/test:
Broken pipe
FAIL
GTester: last random seed: R02S29cea50247fe1efa59ee885a26d51a85
(pid=230423)
FAIL: tests/tpm-crb-test

and generates a new clang sanitizer runtime warning:

/home/petmay01/linaro/qemu-for-merges/hw/tpm/tpm_util.h:36:24: runtime
error: load of misaligned address 0x7fdc24c00002 for type 'const
uint32_t' (aka 'const unsigned int'), which requires 4 byte alignment
0x7fdc24c00002: note: pointer points here
<memory cannot be printed>

The sparc architecture does not allow misaligned loads and will
segfault if you try them.  For example, this function:

static inline uint32_t tpm_cmd_get_size(const void *b)
{
    return be32_to_cpu(*(const uint32_t *)(b + 2));
}

Should read,
    return ldl_be_p(b + 2);

As a general rule you can't take an arbitrary pointer into a byte
buffer and try to interpret it as a structure or a pointer to a
larger-than-bytesize-data simply by casting the pointer.

Use this clean up as an opportunity to remove unnecessary temporary
buffers and casts.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-01-29 14:21:42 -05:00
..
9pfs 9pfs: deprecate handle backend 2018-01-08 11:18:23 +01:00
acpi nvdimm: add 'unarmed' option 2018-01-19 11:18:51 -02:00
adc maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
alpha Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
arm xlnx-zynqmp: Connect the IPI device to the ZynqMP SoC 2018-01-26 11:09:09 +01:00
audio Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
block Block layer patches 2018-01-24 22:55:57 +00:00
bt hw/bt: Replace fprintf(stderr, "*\n" with error_report() 2018-01-22 09:51:00 +01:00
char maint: Fix macros with broken 'do/while(0); ' usage 2018-01-16 14:54:52 +01:00
core linux-user: remove nmi.c and fw-path-provider.c 2018-01-23 14:20:52 +01:00
cpu hw: use "qemu/osdep.h" as first #include in source files 2017-12-18 17:07:02 +03:00
cris cris: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
display aarch64-softmmu.mak: Use an ARM specific config 2018-01-26 11:09:09 +01:00
dma aarch64-softmmu.mak: Use an ARM specific config 2018-01-26 11:09:09 +01:00
gpio Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
i2c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
i386 possible_cpus: add CPUArchId::type field 2018-01-19 11:18:51 -02:00
ide Pull request for various patches that have been reviewed and 2018-01-23 10:15:09 +00:00
input input: add missing newline from trace-events 2018-01-27 17:27:18 +11:00
intc xlnx-zynqmp-ipi: Initial version of the Xilinx IPI device 2018-01-26 11:09:09 +01:00
ipack pci: Add INTERFACE_CONVENTIONAL_PCI_DEVICE to Conventional PCI devices 2017-10-15 05:54:43 +03:00
ipmi hw/ipmi: Replace fprintf(stderr, "*\n" with error_report() 2018-01-22 09:51:00 +01:00
isa hw/isa: Replace fprintf(stderr, "*\n" with error_report() 2018-01-22 09:51:00 +01:00
lm32 lm32: lm32_boards: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
m68k m68k: mcf5208: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
mem nvdimm: add 'unarmed' option 2018-01-19 11:18:51 -02:00
microblaze xlnx-zynqmp-pmu: Connect the IPI device to the PMU 2018-01-26 11:09:09 +01:00
mips Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
misc Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
moxie hw/moxie/moxiesim: Add support for loading a BIOS on moxiesim 2017-12-21 09:30:31 +01:00
net i.MX: Fix FEC/ENET receive funtions 2018-01-25 11:45:28 +00:00
nios2 nios2: remove duplicated includes (in code commented out) 2017-12-18 17:07:02 +03:00
nvram fw_cfg: fix memory corruption when all fw_cfg slots are used 2018-01-19 11:18:51 -02:00
openrisc openrisc: use generic cpu_model parsing 2017-10-27 16:03:54 +02:00
pci pci/shpc: Move function to generic header file 2018-01-18 21:52:38 +02:00
pci-bridge simba: rename PBMPCIBridge and QOM types to reflect simba naming 2018-01-24 19:19:50 +00:00
pci-host uninorth: convert to trace-events 2018-01-27 17:26:46 +11:00
pcmcia hw: Clean up includes 2016-01-29 15:07:25 +00:00
ppc target/ppc/spapr: Add H-Call H_GET_CPU_CHARACTERISTICS 2018-01-29 14:24:55 +11:00
s390x s390x: fix storage attributes migration for non-small guests 2018-01-22 11:04:52 +01:00
scsi usb-storage: Fix share-rw option parsing 2018-01-26 07:58:34 +01:00
sd sdhci: fix a NULL pointer dereference due to uninitialized AddresSpace object 2018-01-25 11:45:30 +00:00
sh4 pci: Rename root bus initialization functions for clarity 2017-12-05 19:13:45 +02:00
smbios Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
sparc sun4m: remove include/hw/sparc/sun4m.h and all references to it 2018-01-09 21:48:20 +00:00
sparc64 sun4u: implement power device 2018-01-25 13:39:39 +00:00
ssi xilinx_spips: Correct usage of an uninitialized local variable 2018-01-25 11:45:30 +00:00
timer Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
tpm tpm: fix alignment issues 2018-01-29 14:21:42 -05:00
tricore tricore: use generic cpu_model parsing 2017-10-27 16:04:27 +02:00
unicore32 hw/unicore32: restrict hw addr defines to source file 2017-12-18 17:07:02 +03:00
usb usb-ccid: convert CCIDCardClass::exitfn() -> unrealize() 2018-01-26 07:59:33 +01:00
vfio Merge remote-tracking branch 'origin/master' into HEAD 2018-01-11 22:03:50 +02:00
virtio Revert "virtio: postpone the execution of event_notifier_cleanup function" 2018-01-24 19:20:19 +02:00
watchdog misc: drop old i386 dependency 2017-12-18 17:07:03 +03:00
xen xen: Add only xen-sysdev to dynamic sysbus device list 2018-01-19 11:18:51 -02:00
xenpv Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
xtensa target/xtensa: allow different default CPU for MMU/noMMU 2018-01-22 11:54:23 -08:00
Makefile.objs 9pfs: fix dependencies 2017-08-30 18:23:25 +02:00