Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-12 Thread Alex Williamson
On Thu, 12 Mar 2020 06:50:30 +0100 Markus Armbruster wrote: > Alex Williamson writes: > > > On Wed, 11 Mar 2020 08:04:28 +0100 > > Markus Armbruster wrote: > > > >> Alex Williamson writes: > >> > >> > On Mon, 24 Feb 2020 14:42:17 +0800 > >> > "Longpeng(Mike)" wrote: > >> > > >> >> F

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Markus Armbruster
Alex Williamson writes: > On Wed, 11 Mar 2020 08:04:28 +0100 > Markus Armbruster wrote: > >> Alex Williamson writes: >> >> > On Mon, 24 Feb 2020 14:42:17 +0800 >> > "Longpeng(Mike)" wrote: >> > >> >> From: Longpeng >> >> >> >> vfio_pci_load_rom() maybe failed and then the vdev->rom is NUL

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Alex Williamson
On Wed, 11 Mar 2020 11:28:26 +0100 Laszlo Ersek wrote: > On 03/11/20 08:08, Markus Armbruster wrote: > > Alex Williamson writes: > > > >> On Wed, 11 Mar 2020 00:14:31 +0100 > >> Laszlo Ersek wrote: > > [...] > >>> So from a memcpy() and range perspective, the patch looks OK. But > >>> th

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Alex Williamson
On Wed, 11 Mar 2020 08:04:28 +0100 Markus Armbruster wrote: > Alex Williamson writes: > > > On Mon, 24 Feb 2020 14:42:17 +0800 > > "Longpeng(Mike)" wrote: > > > >> From: Longpeng > >> > >> vfio_pci_load_rom() maybe failed and then the vdev->rom is NULL in > >> some situation (though I've n

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Laszlo Ersek
On 03/11/20 12:54, Markus Armbruster wrote: > Laszlo Ersek writes: >> In fact I was about to mention, "I really don't understand why compilers >> don't yell upon seeing pointer-to-void arithmetic", but I got distracted >> and forgot about that thought. In retrospect, that may have been for the >>

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Markus Armbruster
Laszlo Ersek writes: > On 03/11/20 02:36, Alex Williamson wrote: >> On Wed, 11 Mar 2020 00:14:31 +0100 >> Laszlo Ersek wrote: >> >>> On 03/10/20 17:11, Alex Williamson wrote: >>> commit 2088fc1e1f426b98e9ca4d7bcdbe53d886a18c37 Author: Alex Williamson Date: Tue Mar 10 10:04:36

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Laszlo Ersek
On 03/11/20 08:08, Markus Armbruster wrote: > Alex Williamson writes: > >> On Wed, 11 Mar 2020 00:14:31 +0100 >> Laszlo Ersek wrote: > [...] >>> So from a memcpy() and range perspective, the patch looks OK. But >>> there's still a wart I dislike: we should never perform pointer >>> arithmetic on

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Laszlo Ersek
On 03/11/20 02:36, Alex Williamson wrote: > On Wed, 11 Mar 2020 00:14:31 +0100 > Laszlo Ersek wrote: > >> On 03/10/20 17:11, Alex Williamson wrote: >> >>> commit 2088fc1e1f426b98e9ca4d7bcdbe53d886a18c37 >>> Author: Alex Williamson >>> Date: Tue Mar 10 10:04:36 2020 -0600 >>> >>> vfio/pci:

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Markus Armbruster
Alex Williamson writes: > On Wed, 11 Mar 2020 00:14:31 +0100 > Laszlo Ersek wrote: [...] >> So from a memcpy() and range perspective, the patch looks OK. But >> there's still a wart I dislike: we should never perform pointer >> arithmetic on a (void*). I suggest casting (vdev->rom) to (uint8_t*)

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-11 Thread Markus Armbruster
Alex Williamson writes: > On Mon, 24 Feb 2020 14:42:17 +0800 > "Longpeng(Mike)" wrote: > >> From: Longpeng >> >> vfio_pci_load_rom() maybe failed and then the vdev->rom is NULL in >> some situation (though I've not encountered yet), maybe we should >> avoid the VM abort. What "VM abort" exact

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-10 Thread Alex Williamson
On Wed, 11 Mar 2020 00:14:31 +0100 Laszlo Ersek wrote: > On 03/10/20 17:11, Alex Williamson wrote: > > > commit 2088fc1e1f426b98e9ca4d7bcdbe53d886a18c37 > > Author: Alex Williamson > > Date: Tue Mar 10 10:04:36 2020 -0600 > > > > vfio/pci: Use defined memcpy() behavior > > > > v

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-10 Thread Laszlo Ersek
On 03/10/20 17:11, Alex Williamson wrote: > commit 2088fc1e1f426b98e9ca4d7bcdbe53d886a18c37 > Author: Alex Williamson > Date: Tue Mar 10 10:04:36 2020 -0600 > > vfio/pci: Use defined memcpy() behavior > > vfio_rom_read() relies on memcpy() doing the logically correct thing, >

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-03-10 Thread Alex Williamson
On Tue, 25 Feb 2020 07:48:33 +0800 "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" wrote: > On 2020/2/25 0:04, Alex Williamson wrote: > > On Mon, 24 Feb 2020 14:42:17 +0800 > > "Longpeng(Mike)" wrote: > > > >> From: Longpeng > >> > >> vfio_pci_load_rom() maybe failed and then t

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-02-24 Thread Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
On 2020/2/25 0:04, Alex Williamson wrote: > On Mon, 24 Feb 2020 14:42:17 +0800 > "Longpeng(Mike)" wrote: > >> From: Longpeng >> >> vfio_pci_load_rom() maybe failed and then the vdev->rom is NULL in >> some situation (though I've not encountered yet), maybe we should >> avoid the VM abort. >>

Re: [PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-02-24 Thread Alex Williamson
On Mon, 24 Feb 2020 14:42:17 +0800 "Longpeng(Mike)" wrote: > From: Longpeng > > vfio_pci_load_rom() maybe failed and then the vdev->rom is NULL in > some situation (though I've not encountered yet), maybe we should > avoid the VM abort. > > Signed-off-by: Longpeng > --- > hw/vfio/pci.c | 13

[PATCH RESEND 1/3] vfio/pci: fix a null pointer reference in vfio_rom_read

2020-02-23 Thread Longpeng(Mike)
From: Longpeng vfio_pci_load_rom() maybe failed and then the vdev->rom is NULL in some situation (though I've not encountered yet), maybe we should avoid the VM abort. Signed-off-by: Longpeng --- hw/vfio/pci.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/hw