forked from Lainports/opnsense-ports
36 lines
1.2 KiB
Diff
36 lines
1.2 KiB
Diff
Subject: [PATCH] tools/kdd: don't use a pointer to an unaligned field.
|
|
|
|
The 'val' field in the packet is byte-aligned (because it is part of a
|
|
packed struct), but the pointer argument to kdd_rdmsr() has the normal
|
|
alignment constraints for a uint64_t *. Use a local variable to make sure
|
|
the passed pointer has the correct alignment.
|
|
|
|
Reported-by: Roger Pau Monné <roger.pau@citrix.com>
|
|
Signed-off-by: Tim Deegan <tim@xen.org>
|
|
---
|
|
tools/debugger/kdd/kdd.c | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
|
|
index 70f007e..1bd5dd5 100644
|
|
--- a/tools/debugger/kdd/kdd.c
|
|
+++ b/tools/debugger/kdd/kdd.c
|
|
@@ -710,11 +710,13 @@ static void kdd_handle_read_ctrl(kdd_state *s)
|
|
static void kdd_handle_read_msr(kdd_state *s)
|
|
{
|
|
uint32_t msr = s->rxp.cmd.msr.msr;
|
|
+ uint64_t val;
|
|
int ok;
|
|
KDD_LOG(s, "Read MSR 0x%"PRIx32"\n", msr);
|
|
|
|
- ok = (kdd_rdmsr(s->guest, s->cpuid, msr, &s->txp.cmd.msr.val) == 0);
|
|
+ ok = (kdd_rdmsr(s->guest, s->cpuid, msr, &val) == 0);
|
|
s->txp.cmd.msr.msr = msr;
|
|
+ s->txp.cmd.msr.val = val;
|
|
s->txp.cmd.msr.status = (ok ? KDD_STATUS_SUCCESS : KDD_STATUS_FAILURE);
|
|
kdd_send_cmd(s, KDD_CMD_READ_MSR, 0);
|
|
}
|
|
--
|
|
2.7.4
|
|
|
|
|