mirror of
https://github.com/simh/simh.git
synced 2026-01-26 04:01:38 +00:00
ibmpc, isys80xx, imds-225: Fix Coverity identified problems
This commit is contained in:
@@ -391,12 +391,14 @@ t_stat isbc201_attach (UNIT *uptr, CONST char *cptr)
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (flen == -1) {
|
||||
sim_printf(" isbc201_attach: File error\n");
|
||||
fclose(fp);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
if (fdc201[fdcnum].fdd[fddnum].buf == NULL) { /* no buffer allocated */
|
||||
fdc201[fdcnum].fdd[fddnum].buf = (uint8 *)malloc(flen);
|
||||
if (fdc201[fdcnum].fdd[fddnum].buf == NULL) {
|
||||
sim_printf(" isbc201_attach: Malloc error\n");
|
||||
fclose(fp);
|
||||
return SCPE_MEM;
|
||||
}
|
||||
}
|
||||
@@ -450,8 +452,7 @@ uint8 isbc201_get_dn(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// for (i=0; i<SBC201_NUM; i++)
|
||||
for (i=0; i<=SBC201_NUM; i++)
|
||||
for (i=0; i<SBC201_NUM; i++)
|
||||
if (port >= fdc201[i].baseport && port <= fdc201[i].baseport + 7)
|
||||
return i;
|
||||
sim_printf("isbc201_get_dn: port %04X not in isbc202 device table\n", port);
|
||||
|
||||
@@ -405,12 +405,14 @@ t_stat isbc202_attach (UNIT *uptr, CONST char *cptr)
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (flen == -1) {
|
||||
sim_printf(" isbc202_attach: File error\n");
|
||||
fclose(fp);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
if (fdc202[fdcnum].fdd[fddnum].buf == NULL) { /* no buffer allocated */
|
||||
fdc202[fdcnum].fdd[fddnum].buf = (uint8 *)malloc(flen);
|
||||
if (fdc202[fdcnum].fdd[fddnum].buf == NULL) {
|
||||
sim_printf(" isbc202_attach: Malloc error\n");
|
||||
fclose(fp);
|
||||
return SCPE_MEM;
|
||||
}
|
||||
}
|
||||
@@ -477,8 +479,7 @@ uint8 isbc202_get_dn(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// for (i=0; i<SBC202_NUM; i++)
|
||||
for (i=0; i<=SBC202_NUM; i++)
|
||||
for (i=0; i<SBC202_NUM; i++)
|
||||
if (port >= fdc202[i].baseport && port <= fdc202[i].baseport + 7)
|
||||
return i;
|
||||
sim_printf("isbc202_get_dn: port %04X not in isbc202 device table\n", port);
|
||||
|
||||
@@ -1071,12 +1071,14 @@ t_stat isbc208_attach (UNIT *uptr, CONST char *cptr)
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (flen == -1) {
|
||||
sim_printf(" isbc208_attach: File error\n");
|
||||
fclose(fp);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
if (isbc208_buf[uptr->u6] == NULL) { /* no buffer allocated */
|
||||
isbc208_buf[uptr->u6] = (uint8 *)malloc(flen);
|
||||
if (isbc208_buf[uptr->u6] == NULL) {
|
||||
sim_printf(" iSBC208_attach: Malloc error\n");
|
||||
fclose(fp);
|
||||
return SCPE_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,12 +420,14 @@ t_stat zx200a_attach (UNIT *uptr, CONST char *cptr)
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (flen == -1) {
|
||||
sim_printf(" zx200a_attach: File error\n");
|
||||
fclose(fp);
|
||||
return SCPE_IOERR;
|
||||
}
|
||||
if (zx200a[fdcnum].fdd[fddnum].buf == NULL) { /* no buffer allocated */
|
||||
zx200a[fdcnum].fdd[fddnum].buf = (uint8 *)malloc(flen);
|
||||
if (zx200a[fdcnum].fdd[fddnum].buf == NULL) {
|
||||
sim_printf(" zx200a_attach: Malloc error\n");
|
||||
fclose(fp);
|
||||
return SCPE_MEM;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user