Various Magtape Devices: Handle Coverity report of tape error status cases

Coverity flagged one magtape simulator for having fewer case breakouts
than the range of MTSE_x errors, after they were expanded for
MTSE_LEOT (listed as "V4 compatibility") and MTSE_RUNAWAY (for
Dave Bryan's implementation of erase and erase gap).

According to Dave, it turns out that MTSE_RUNAWAY can only be
returned if the magtape simulator supports and implements a density
specification and the ERASE function. The simulators Bob Supnik wrote
don't meet that criteria, so the expanded errors can't be returned.

Simply add a "default" case to the map logic returning SCPE_IERR for
unexpected cases.
This commit is contained in:
Mark Pizzolato 2022-03-13 11:23:11 -07:00
parent 4fa0eaad99
commit 8c325db1ab
10 changed files with 30 additions and 0 deletions

View file

@ -551,6 +551,9 @@ switch (st) {
case MTSE_WRP: /* write protect */ case MTSE_WRP: /* write protect */
mt_err = 1; /* error */ mt_err = 1; /* error */
return STOP_MTWRP; return STOP_MTWRP;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return SCPE_OK; return SCPE_OK;

View file

@ -443,6 +443,9 @@ switch (st) {
case MTSE_WRP: /* write protect */ case MTSE_WRP: /* write protect */
return STOP_MTL; return STOP_MTL;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return SCPE_OK; return SCPE_OK;

View file

@ -797,6 +797,9 @@ switch (st) {
case MTSE_OK: /* no error */ case MTSE_OK: /* no error */
break; break;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return SCPE_OK; return SCPE_OK;

View file

@ -454,6 +454,9 @@ switch (st) {
case MTSE_BOT: /* reverse into BOT */ case MTSE_BOT: /* reverse into BOT */
uptr->UST = uptr->UST | STA_EOT; /* set err */ uptr->UST = uptr->UST | STA_EOT; /* set err */
break; break;
default: /* shouldn't happen */
return SCPE_IERR;
} /* end switch */ } /* end switch */
return SCPE_OK; return SCPE_OK;

View file

@ -552,6 +552,9 @@ switch (st) {
mta_upddsta (uptr, uptr->USTAT | STA_WLK | STA_RDY); mta_upddsta (uptr, uptr->USTAT | STA_WLK | STA_RDY);
mta_sta = mta_sta | STA_ILL; /* illegal operation */ mta_sta = mta_sta | STA_ILL; /* illegal operation */
break; break;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return SCPE_OK; return SCPE_OK;

View file

@ -572,6 +572,9 @@ switch (st) {
case MTSE_WRP: /* write protect */ case MTSE_WRP: /* write protect */
tm_sta = tm_sta | STA_ILL; /* illegal operation */ tm_sta = tm_sta | STA_ILL; /* illegal operation */
break; break;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return SCPE_OK; return SCPE_OK;

View file

@ -1585,6 +1585,9 @@ switch (st) {
case MTSE_LEOT: case MTSE_LEOT:
return ST_LED; return ST_LED;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return ST_SUC; return ST_SUC;

View file

@ -500,6 +500,9 @@ switch (st) {
case MTSE_WRP: /* write protect */ case MTSE_WRP: /* write protect */
msgxs0 = msgxs0 | XS0_WLE | XS0_NEF; /* can't execute */ msgxs0 = msgxs0 | XS0_WLE | XS0_NEF; /* can't execute */
return (XTC (XS0_WLE | XS0_NEF, TC3)); return (XTC (XS0_WLE | XS0_NEF, TC3));
default: /* shouldn't happen */
return SCPE_IERR;
} }
return 0; return 0;

View file

@ -472,6 +472,9 @@ switch (st) {
case MTSE_WRP: /* write protect */ case MTSE_WRP: /* write protect */
mt_sta = mt_sta | STA_ILL | STA_ERR; /* illegal operation */ mt_sta = mt_sta | STA_ILL | STA_ERR; /* illegal operation */
break; break;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return SCPE_OK; return SCPE_OK;

View file

@ -590,6 +590,9 @@ switch (st) {
case MTSE_WRP: /* write protect */ case MTSE_WRP: /* write protect */
mt_sta = mt_sta | STA_ILL | STA_ERR; /* illegal operation */ mt_sta = mt_sta | STA_ILL | STA_ERR; /* illegal operation */
break; break;
default: /* shouldn't happen */
return SCPE_IERR;
} }
return SCPE_OK; return SCPE_OK;