From 625d1b391e293a21c286c921c13daead288d2d9e Mon Sep 17 00:00:00 2001 From: Bill Beech Date: Wed, 7 Jun 2017 11:06:02 -0700 Subject: [PATCH] swtp6800: Solve Coverity identified issues --- swtp6800/common/dc-4.c | 12 ++++++++++-- swtp6800/common/mp-a2.c | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/swtp6800/common/dc-4.c b/swtp6800/common/dc-4.c index a0451659..f979b435 100644 --- a/swtp6800/common/dc-4.c +++ b/swtp6800/common/dc-4.c @@ -398,7 +398,11 @@ int32 fdcdrv(int32 io, int32 data) sim_printf("\nfdccmd: File error\n"); return SCPE_IOERR; } - sim_fread(dsk_unit[cur_dsk].filebuf, SECSIZ, 1, dsk_unit[cur_dsk].fileref); /* read in buffer */ + err = sim_fread(dsk_unit[cur_dsk].filebuf, SECSIZ, 1, dsk_unit[cur_dsk].fileref); /* read in buffer */ + if (err) { + sim_printf("\nfdccmd: File error\n"); + return SCPE_IOERR; + } dsk_unit[cur_dsk].u3 |= BUSY | DRQ; /* set DRQ & BUSY */ dsk_unit[cur_dsk].pos = 0; /* clear counter */ spt = *((uint8 *)(dsk_unit[cur_dsk].filebuf) + MAXSEC) & 0xFF; @@ -445,7 +449,11 @@ int32 fdccmd(int32 io, int32 data) sim_printf("\nfdccmd: File error\n"); return SCPE_IOERR; } - sim_fread(dsk_unit[cur_dsk].filebuf, SECSIZ, 1, dsk_unit[cur_dsk].fileref); /* read in buffer */ + err = sim_fread(dsk_unit[cur_dsk].filebuf, SECSIZ, 1, dsk_unit[cur_dsk].fileref); /* read in buffer */ + if (err) { + sim_printf("\nfdccmd: File error\n"); + return SCPE_IOERR; + } dsk_unit[cur_dsk].u3 |= BUSY | DRQ; /* set DRQ & BUSY */ dsk_unit[cur_dsk].pos = 0; /* clear counter */ break; diff --git a/swtp6800/common/mp-a2.c b/swtp6800/common/mp-a2.c index 6ad9af09..b83aa629 100644 --- a/swtp6800/common/mp-a2.c +++ b/swtp6800/common/mp-a2.c @@ -173,7 +173,7 @@ int32 get_base(void) int32 CPU_BD_get_mbyte(int32 addr) { - int32 val; + int32 val = 0; sim_debug (DEBUG_read, &CPU_BD_dev, "CPU_BD_get_mbyte: addr=%04X\n", addr); switch(addr & 0xF000) {