[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 5/6] nvram: add nrf51_soc flash read method
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 5/6] nvram: add nrf51_soc flash read method |
Date: |
Wed, 17 Jun 2020 09:42:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 6/17/20 7:39 AM, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
>
> Add nrf51_soc mmio read method to avoid NULL pointer dereference
> issue.
>
> Reported-by: Lei Sun <slei.casper@gmail.com>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> ---
> hw/nvram/nrf51_nvm.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/hw/nvram/nrf51_nvm.c b/hw/nvram/nrf51_nvm.c
> index f2283c1a8d..e813c7ec72 100644
> --- a/hw/nvram/nrf51_nvm.c
> +++ b/hw/nvram/nrf51_nvm.c
> @@ -274,6 +274,12 @@ static const MemoryRegionOps io_ops = {
> };
>
>
> +static uint64_t flash_read(void *opaque, hwaddr addr, unsigned size)
> +{
> + qemu_log_mask(LOG_UNIMP, "%s not implemented\n", __func__);
> + return 0;
This is a ROM device, shouldn't we return this instead?
return ldl_le_p(s->storage + offset);
> +}
> +
> static void flash_write(void *opaque, hwaddr offset, uint64_t value,
> unsigned int size)
> {
> @@ -300,6 +306,7 @@ static void flash_write(void *opaque, hwaddr offset,
> uint64_t value,
>
>
> static const MemoryRegionOps flash_ops = {
> + .read = flash_read,
> .write = flash_write,
> .valid.min_access_size = 4,
> .valid.max_access_size = 4,
>
- [PATCH 0/6] Add various undefined MMIO r/w functions, P J P, 2020/06/17
- [PATCH 1/6] hw/pci-host: add pci-intack write method, P J P, 2020/06/17
- [PATCH 2/6] pci-host: add pcie-msi read method, P J P, 2020/06/17
- [PATCH 3/6] vfio: add quirk device write method, P J P, 2020/06/17
- [PATCH 4/6] prep: add ppc-parity write method, P J P, 2020/06/17
- [PATCH 5/6] nvram: add nrf51_soc flash read method, P J P, 2020/06/17
- Re: [PATCH 5/6] nvram: add nrf51_soc flash read method,
Philippe Mathieu-Daudé <=
- [PATCH 6/6] spapr_pci: add spapr msi read method, P J P, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, no-reply, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, David Gibson, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, Alex Williamson, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, Philippe Mathieu-Daudé, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, Alex Bennée, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, Philippe Mathieu-Daudé, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, Paolo Bonzini, 2020/06/17
- Re: [PATCH 0/6] Add various undefined MMIO r/w functions, P J P, 2020/06/17