Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-24 Thread David Gibson
@redhat.com, "Michael > > S. Tsirkin" , "Marcel Apfelbaum" > > Sent: Wednesday, May 24, 2017 8:35:04 AM > > Subject: Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error > > handling > > > > Philippe Mathieu-Daudé writes: >

Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-24 Thread Marcel Apfelbaum
Sent: Wednesday, May 24, 2017 8:35:04 AM > Subject: Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error > handling > > Philippe Mathieu-Daudé writes: > > > Hi Markus, > > > > On 05/23/2017 06:27 AM, Markus Armbruster wrote: > > [...]

Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-23 Thread Markus Armbruster
Philippe Mathieu-Daudé writes: > Hi Markus, > > On 05/23/2017 06:27 AM, Markus Armbruster wrote: > [...] >> There's one more cleanup opportunity: >> > [...] >>> if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, >>> size)) { >>> return NULL; >>> } >> >> None of

Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-23 Thread Philippe Mathieu-Daudé
Hi Markus, On 05/23/2017 06:27 AM, Markus Armbruster wrote: [...] There's one more cleanup opportunity: [...] if (pci_dma_read(dev, le64_to_cpu(info->desc.buf_addr), info->buf, size)) { return NULL; } None of the pci_dma_read() calls outside rocker check the return value.

Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-23 Thread Markus Armbruster
Mao Zhongyi writes: > Hi, Markus > > > On 05/23/2017 05:27 PM, Markus Armbruster wrote: >> Mao Zhongyi writes: >> >>> Memory allocation functions like world_alloc, desc_ring_alloc etc, >>> they are all wrappers around g_malloc, g_new etc. But g_malloc and >>> similar functions doesn't return nul

Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-23 Thread Mao Zhongyi
Hi, Markus On 05/23/2017 05:27 PM, Markus Armbruster wrote: Mao Zhongyi writes: Memory allocation functions like world_alloc, desc_ring_alloc etc, they are all wrappers around g_malloc, g_new etc. But g_malloc and similar functions doesn't return null. Because they ignore the fact don't

Re: [Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-23 Thread Markus Armbruster
Mao Zhongyi writes: > Memory allocation functions like world_alloc, desc_ring_alloc etc, > they are all wrappers around g_malloc, g_new etc. But g_malloc and > similar functions doesn't return null. Because they ignore the fact don't > that g_malloc() of 0 bytes returns null. So error checks

[Qemu-devel] [PATCH v5 1/4] net/rocker: Remove the dead error handling

2017-05-22 Thread Mao Zhongyi
Memory allocation functions like world_alloc, desc_ring_alloc etc, they are all wrappers around g_malloc, g_new etc. But g_malloc and similar functions doesn't return null. Because they ignore the fact that g_malloc() of 0 bytes returns null. So error checks for these allocation failure are super