Message ID | 1454072434-16045-1-git-send-email-ppandit@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Fr, 2016-01-29 at 18:30 +0530, P J P wrote: > From: Prasad J Pandit <pjp@fedoraproject.org> > > USB Ehci emulation supports host controller capability registers. > But its mmio '.write' function was missing, which lead to a null > pointer dereference issue. Add a do nothing 'ehci_caps_write' > definition to avoid it; Do nothing because capability registers > are Read Only(RO). Surely makes sense, xhci does the same, I'll pick it up. Maybe we should have a generic nop_write function somewhere. Not that there can much go wrong by cut&pasting here, but still ... cheers, Gerd
Hello Gerd, +-- On Fri, 29 Jan 2016, Gerd Hoffmann wrote --+ | On Fr, 2016-01-29 at 18:30 +0530, P J P wrote: | > pointer dereference issue. Add a do nothing 'ehci_caps_write' | > definition to avoid it; Do nothing because capability registers | > are Read Only(RO). | | Surely makes sense, xhci does the same, I'll pick it up. Cool! Thank you. | Maybe we should have a generic nop_write function somewhere. Not that there True. Would one nop_write function serve them all? I mean do they share the same prototype/syntax? -- Prasad J Pandit / Red Hat Product Security Team 47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index c40013e..b08ff62 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -893,6 +893,11 @@ static uint64_t ehci_caps_read(void *ptr, hwaddr addr, return s->caps[addr]; } +static void ehci_caps_write(void *ptr, hwaddr addr, + uint64_t val, unsigned size) +{ +} + static uint64_t ehci_opreg_read(void *ptr, hwaddr addr, unsigned size) { @@ -2313,6 +2318,7 @@ static void ehci_frame_timer(void *opaque) static const MemoryRegionOps ehci_mmio_caps_ops = { .read = ehci_caps_read, + .write = ehci_caps_write, .valid.min_access_size = 1, .valid.max_access_size = 4, .impl.min_access_size = 1,