ppc/pnv: Fix check on block device before updating drive contents

Test is wrong and the backend can never updated. It could have led to
a QEMU crash but since the firmware deactivates flash access if a valid
layout is not detected, it went unnoticed.

Reported-by: Coverity CID 1465223
Fixes: 35dde57662 ("ppc/pnv: Add a PNOR model")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <20211102162905.762078-1-clg@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Cédric Le Goater 2021-11-02 17:29:05 +01:00 committed by David Gibson
parent a23297479c
commit 957c52aed5
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ static void pnv_pnor_update(PnvPnor *s, int offset, int size)
int offset_end;
int ret;
if (s->blk) {
if (!s->blk || !blk_is_writable(s->blk)) {
return;
}