Revision 3b698f52f9fabb4fb7844f57160c65cd6ce6513c authored by Peter Maydell on 09 October 2018, 17:24:59 UTC, committed by Kevin Wolf on 05 November 2018, 14:09:54 UTC
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. There are a few places where the in-place swap function is used on something other than a packed struct field; we convert those anyway, for consistency. This patch was produced with the following spatch script (and hand-editing to fold a few resulting overlength lines): @@ expression E; @@ -be16_to_cpus(&E); +E = be16_to_cpu(E); @@ expression E; @@ -be32_to_cpus(&E); +E = be32_to_cpu(E); @@ expression E; @@ -be64_to_cpus(&E); +E = be64_to_cpu(E); @@ expression E; @@ -cpu_to_be16s(&E); +E = cpu_to_be16(E); @@ expression E; @@ -cpu_to_be32s(&E); +E = cpu_to_be32(E); @@ expression E; @@ -cpu_to_be64s(&E); +E = cpu_to_be64(E); Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: John Snow <jsnow@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 parent cf67b69
File | Mode | Size |
---|---|---|
Makefile.objs | -rw-r--r-- | 310 bytes |
block-core.json | -rw-r--r-- | 156.0 KB |
block.json | -rw-r--r-- | 12.6 KB |
char.json | -rw-r--r-- | 13.9 KB |
common.json | -rw-r--r-- | 3.3 KB |
crypto.json | -rw-r--r-- | 8.3 KB |
introspect.json | -rw-r--r-- | 7.6 KB |
job.json | -rw-r--r-- | 7.2 KB |
migration.json | -rw-r--r-- | 41.3 KB |
misc.json | -rw-r--r-- | 87.9 KB |
net.json | -rw-r--r-- | 16.2 KB |
opts-visitor.c | -rw-r--r-- | 15.0 KB |
qapi-clone-visitor.c | -rw-r--r-- | 5.3 KB |
qapi-dealloc-visitor.c | -rw-r--r-- | 3.6 KB |
qapi-schema.json | -rw-r--r-- | 3.6 KB |
qapi-util.c | -rw-r--r-- | 2.0 KB |
qapi-visit-core.c | -rw-r--r-- | 9.9 KB |
qmp-dispatch.c | -rw-r--r-- | 4.9 KB |
qmp-event.c | -rw-r--r-- | 1.3 KB |
qmp-registry.c | -rw-r--r-- | 2.1 KB |
qobject-input-visitor.c | -rw-r--r-- | 20.1 KB |
qobject-output-visitor.c | -rw-r--r-- | 7.7 KB |
rocker.json | -rw-r--r-- | 7.5 KB |
run-state.json | -rw-r--r-- | 9.5 KB |
sockets.json | -rw-r--r-- | 3.3 KB |
string-input-visitor.c | -rw-r--r-- | 9.0 KB |
string-output-visitor.c | -rw-r--r-- | 10.1 KB |
tpm.json | -rw-r--r-- | 2.9 KB |
trace-events | -rw-r--r-- | 2.0 KB |
trace.json | -rw-r--r-- | 2.8 KB |
transaction.json | -rw-r--r-- | 5.6 KB |
ui.json | -rw-r--r-- | 28.9 KB |
Computing file changes ...