diff mbox series

[v4,1/2] hw/block: m25p80: Don't write to flash if write is disabled

Message ID 1608619520-62782-1-git-send-email-bmeng.cn@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v4,1/2] hw/block: m25p80: Don't write to flash if write is disabled | expand

Commit Message

Bin Meng Dec. 22, 2020, 6:45 a.m. UTC
From: Bin Meng <bin.meng@windriver.com>

When write is disabled, the write to flash should be avoided
in flash_write8().

Fixes: 82a2499011a7 ("m25p80: Initial implementation of SPI flash device")
Signed-off-by: Bin Meng <bin.meng@windriver.com>

---

(no changes since v2)

Changes in v2:
- new patch: honor write enable flag in flash write

 hw/block/m25p80.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Philippe Mathieu-Daudé Dec. 22, 2020, 2:25 p.m. UTC | #1
On 12/22/20 7:45 AM, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> When write is disabled, the write to flash should be avoided
> in flash_write8().
> 
> Fixes: 82a2499011a7 ("m25p80: Initial implementation of SPI flash device")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> 
> ---
> 
> (no changes since v2)
> 
> Changes in v2:
> - new patch: honor write enable flag in flash write
> 
>  hw/block/m25p80.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 483925f..236e1b4 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -594,6 +594,7 @@ void flash_write8(Flash *s, uint32_t addr, uint8_t data)
>  
>      if (!s->write_enable) {
>          qemu_log_mask(LOG_GUEST_ERROR, "M25P80: write with write protect!\n");
> +        return;
>      }
>  
>      if ((prev ^ data) & data) {
> 

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Francisco Iglesias Dec. 22, 2020, 3:55 p.m. UTC | #2
On [2020 Dec 22] Tue 14:45:19, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> When write is disabled, the write to flash should be avoided
> in flash_write8().
> 
> Fixes: 82a2499011a7 ("m25p80: Initial implementation of SPI flash device")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>

Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com>

> 
> ---
> 
> (no changes since v2)
> 
> Changes in v2:
> - new patch: honor write enable flag in flash write
> 
>  hw/block/m25p80.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
> index 483925f..236e1b4 100644
> --- a/hw/block/m25p80.c
> +++ b/hw/block/m25p80.c
> @@ -594,6 +594,7 @@ void flash_write8(Flash *s, uint32_t addr, uint8_t data)
>  
>      if (!s->write_enable) {
>          qemu_log_mask(LOG_GUEST_ERROR, "M25P80: write with write protect!\n");
> +        return;
>      }
>  
>      if ((prev ^ data) & data) {
> -- 
> 2.7.4
>
Bin Meng Jan. 5, 2021, 3:46 a.m. UTC | #3
Hello,

On Tue, Dec 22, 2020 at 2:45 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> From: Bin Meng <bin.meng@windriver.com>
>
> When write is disabled, the write to flash should be avoided
> in flash_write8().
>
> Fixes: 82a2499011a7 ("m25p80: Initial implementation of SPI flash device")
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
>
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - new patch: honor write enable flag in flash write
>
>  hw/block/m25p80.c | 1 +
>  1 file changed, 1 insertion(+)
>

Who is going to pick up this series? Is it Alistair, or Peter?

Regards,
Bin
Bin Meng Jan. 5, 2021, 3:49 a.m. UTC | #4
On Tue, Jan 5, 2021 at 11:46 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hello,
>
> On Tue, Dec 22, 2020 at 2:45 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > From: Bin Meng <bin.meng@windriver.com>
> >
> > When write is disabled, the write to flash should be avoided
> > in flash_write8().
> >
> > Fixes: 82a2499011a7 ("m25p80: Initial implementation of SPI flash device")
> > Signed-off-by: Bin Meng <bin.meng@windriver.com>
> >
> > ---
> >
> > (no changes since v2)
> >
> > Changes in v2:
> > - new patch: honor write enable flag in flash write
> >
> >  hw/block/m25p80.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
>
> Who is going to pick up this series? Is it Alistair, or Peter?
>

Oops, I replied to the wrong thread. There is a v5 series that should
be applied.

Regards,
Bin
diff mbox series

Patch

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 483925f..236e1b4 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -594,6 +594,7 @@  void flash_write8(Flash *s, uint32_t addr, uint8_t data)
 
     if (!s->write_enable) {
         qemu_log_mask(LOG_GUEST_ERROR, "M25P80: write with write protect!\n");
+        return;
     }
 
     if ((prev ^ data) & data) {