mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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> Acked-by: Roger Pau Monné <roger.pau@citrix.com> Tested-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
1 parent
327f54ed7f
commit
bfd9a2095f
1 file changed
+3
-1
@@ -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);
|
||||
}
|
||||
|
||||