diff options
| author | BALATON Zoltan <balaton@eik.bme.hu> | 2025-03-20 14:40:23 +1000 |
|---|---|---|
| committer | Nicholas Piggin <npiggin@gmail.com> | 2025-03-21 13:54:32 +1000 |
| commit | 0cb6498b4ce8d0e800e85a43429919c208537405 (patch) | |
| tree | 1c0f5a748a403cc53f73bc2395b432b88949195b | |
| parent | d8b1c3eaed5cf11d2db702a415df082dc1754b2c (diff) | |
| download | focaccia-qemu-0cb6498b4ce8d0e800e85a43429919c208537405.tar.gz focaccia-qemu-0cb6498b4ce8d0e800e85a43429919c208537405.zip | |
ppc/amigaone: Check blk_pwrite return value
Coverity reported that return value of blk_pwrite() maybe should not be ignored. We can't do much if this happens other than report an error but let's do that to silence this report. Resolves: Coverity CID 1593725 Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Message-ID: <20250314200140.2DBE74E6069@zero.eik.bme.hu> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
| -rw-r--r-- | hw/ppc/amigaone.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/hw/ppc/amigaone.c b/hw/ppc/amigaone.c index 483512125f..5d787c3059 100644 --- a/hw/ppc/amigaone.c +++ b/hw/ppc/amigaone.c @@ -108,8 +108,8 @@ static void nvram_write(void *opaque, hwaddr addr, uint64_t val, uint8_t *p = memory_region_get_ram_ptr(&s->mr); p[addr] = val; - if (s->blk) { - blk_pwrite(s->blk, addr, 1, &val, 0); + if (s->blk && blk_pwrite(s->blk, addr, 1, &val, 0) < 0) { + error_report("%s: could not write %s", __func__, blk_name(s->blk)); } } @@ -151,15 +151,17 @@ static void nvram_realize(DeviceState *dev, Error **errp) *c = cpu_to_be32(CRC32_DEFAULT_ENV); /* Also copies terminating \0 as env is terminated by \0\0 */ memcpy(p + 4, default_env, sizeof(default_env)); - if (s->blk) { - blk_pwrite(s->blk, 0, sizeof(crc) + sizeof(default_env), p, 0); + if (s->blk && + blk_pwrite(s->blk, 0, sizeof(crc) + sizeof(default_env), p, 0) < 0 + ) { + error_report("%s: could not write %s", __func__, blk_name(s->blk)); } return; } if (*c == 0) { *c = cpu_to_be32(crc32(0, p + 4, NVRAM_SIZE - 4)); - if (s->blk) { - blk_pwrite(s->blk, 0, 4, p, 0); + if (s->blk && blk_pwrite(s->blk, 0, 4, p, 0) < 0) { + error_report("%s: could not write %s", __func__, blk_name(s->blk)); } } if (be32_to_cpu(*c) != crc) { |