From 8c325db1abb2f78ccbf6f8340042f90c6786c17a Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sun, 13 Mar 2022 11:23:11 -0700 Subject: [PATCH] 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. --- H316/h316_mt.c | 3 +++ I1401/i1401_mt.c | 3 +++ I7094/i7094_mt.c | 3 +++ Interdata/id_mt.c | 3 +++ NOVA/nova_mta.c | 3 +++ PDP11/pdp11_tm.c | 3 +++ PDP11/pdp11_tq.c | 3 +++ PDP11/pdp11_ts.c | 3 +++ PDP18B/pdp18b_mt.c | 3 +++ PDP8/pdp8_mt.c | 3 +++ 10 files changed, 30 insertions(+) diff --git a/H316/h316_mt.c b/H316/h316_mt.c index 442cc37a..98d028b4 100644 --- a/H316/h316_mt.c +++ b/H316/h316_mt.c @@ -551,6 +551,9 @@ switch (st) { case MTSE_WRP: /* write protect */ mt_err = 1; /* error */ return STOP_MTWRP; + + default: /* shouldn't happen */ + return SCPE_IERR; } return SCPE_OK; diff --git a/I1401/i1401_mt.c b/I1401/i1401_mt.c index 0b1f55db..925da9cc 100644 --- a/I1401/i1401_mt.c +++ b/I1401/i1401_mt.c @@ -443,6 +443,9 @@ switch (st) { case MTSE_WRP: /* write protect */ return STOP_MTL; + + default: /* shouldn't happen */ + return SCPE_IERR; } return SCPE_OK; diff --git a/I7094/i7094_mt.c b/I7094/i7094_mt.c index 924a485d..cbd4b2af 100644 --- a/I7094/i7094_mt.c +++ b/I7094/i7094_mt.c @@ -797,6 +797,9 @@ switch (st) { case MTSE_OK: /* no error */ break; + + default: /* shouldn't happen */ + return SCPE_IERR; } return SCPE_OK; diff --git a/Interdata/id_mt.c b/Interdata/id_mt.c index 0d320145..8421221a 100644 --- a/Interdata/id_mt.c +++ b/Interdata/id_mt.c @@ -454,6 +454,9 @@ switch (st) { case MTSE_BOT: /* reverse into BOT */ uptr->UST = uptr->UST | STA_EOT; /* set err */ break; + + default: /* shouldn't happen */ + return SCPE_IERR; } /* end switch */ return SCPE_OK; diff --git a/NOVA/nova_mta.c b/NOVA/nova_mta.c index 15822877..71439d8e 100644 --- a/NOVA/nova_mta.c +++ b/NOVA/nova_mta.c @@ -552,6 +552,9 @@ switch (st) { mta_upddsta (uptr, uptr->USTAT | STA_WLK | STA_RDY); mta_sta = mta_sta | STA_ILL; /* illegal operation */ break; + + default: /* shouldn't happen */ + return SCPE_IERR; } return SCPE_OK; diff --git a/PDP11/pdp11_tm.c b/PDP11/pdp11_tm.c index af532c14..789086c8 100644 --- a/PDP11/pdp11_tm.c +++ b/PDP11/pdp11_tm.c @@ -572,6 +572,9 @@ switch (st) { case MTSE_WRP: /* write protect */ tm_sta = tm_sta | STA_ILL; /* illegal operation */ break; + + default: /* shouldn't happen */ + return SCPE_IERR; } return SCPE_OK; diff --git a/PDP11/pdp11_tq.c b/PDP11/pdp11_tq.c index 01460dcb..c0f007b5 100644 --- a/PDP11/pdp11_tq.c +++ b/PDP11/pdp11_tq.c @@ -1585,6 +1585,9 @@ switch (st) { case MTSE_LEOT: return ST_LED; + + default: /* shouldn't happen */ + return SCPE_IERR; } return ST_SUC; diff --git a/PDP11/pdp11_ts.c b/PDP11/pdp11_ts.c index 710e2453..e60433cf 100644 --- a/PDP11/pdp11_ts.c +++ b/PDP11/pdp11_ts.c @@ -500,6 +500,9 @@ switch (st) { case MTSE_WRP: /* write protect */ msgxs0 = msgxs0 | XS0_WLE | XS0_NEF; /* can't execute */ return (XTC (XS0_WLE | XS0_NEF, TC3)); + + default: /* shouldn't happen */ + return SCPE_IERR; } return 0; diff --git a/PDP18B/pdp18b_mt.c b/PDP18B/pdp18b_mt.c index 7656e61e..b320d606 100644 --- a/PDP18B/pdp18b_mt.c +++ b/PDP18B/pdp18b_mt.c @@ -472,6 +472,9 @@ switch (st) { case MTSE_WRP: /* write protect */ mt_sta = mt_sta | STA_ILL | STA_ERR; /* illegal operation */ break; + + default: /* shouldn't happen */ + return SCPE_IERR; } return SCPE_OK; diff --git a/PDP8/pdp8_mt.c b/PDP8/pdp8_mt.c index 9d65e988..d1fec899 100644 --- a/PDP8/pdp8_mt.c +++ b/PDP8/pdp8_mt.c @@ -590,6 +590,9 @@ switch (st) { case MTSE_WRP: /* write protect */ mt_sta = mt_sta | STA_ILL | STA_ERR; /* illegal operation */ break; + + default: /* shouldn't happen */ + return SCPE_IERR; } return SCPE_OK;