summaryrefslogtreecommitdiffstats
path: root/hw/misc/pc-testdev.c
diff options
context:
space:
mode:
authorPeter Maydell2018-09-27 15:48:52 +0200
committerPaolo Bonzini2018-10-02 19:09:14 +0200
commit97866508669c4a75f531bfa94f8267900fcbb5dc (patch)
treeb414d9e2871c2a701ed3c42a15cfd7d289a9db7e /hw/misc/pc-testdev.c
parentcpus: fix TCG kick timer leak (diff)
downloadqemu-97866508669c4a75f531bfa94f8267900fcbb5dc.tar.gz
qemu-97866508669c4a75f531bfa94f8267900fcbb5dc.tar.xz
qemu-97866508669c4a75f531bfa94f8267900fcbb5dc.zip
hw/scsi/mptendian: Avoid taking address of fields in packed structs
Taking the address of a field in a packed struct is a bad idea, because it might not be actually aligned enough for that pointer type (and thus cause a crash on dereference on some host architectures). Newer versions of clang warn about this. Avoid the bug by not using the "modify in place" byte swapping functions. This patch was produced with the following simple spatch script: @@ expression E; @@ -le16_to_cpus(&E); +E = le16_to_cpu(E); @@ expression E; @@ -le32_to_cpus(&E); +E = le32_to_cpu(E); @@ expression E; @@ -le64_to_cpus(&E); +E = le64_to_cpu(E); @@ expression E; @@ -cpu_to_le16s(&E); +E = cpu_to_le16(E); @@ expression E; @@ -cpu_to_le32s(&E); +E = cpu_to_le32(E); @@ expression E; @@ -cpu_to_le64s(&E); +E = cpu_to_le64(E); followed by some minor tidying of overlong lines and bad indent. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20180927134852.21490-1-peter.maydell@linaro.org> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/misc/pc-testdev.c')
0 files changed, 0 insertions, 0 deletions