SCP, DISK: Fix Coverity identified debug path null pointer dereferences

This commit is contained in:
Mark Pizzolato 2018-04-17 23:51:39 -07:00
parent 309598e2cd
commit 15e86fb4ed
2 changed files with 3 additions and 2 deletions

2
scp.c
View file

@ -6659,6 +6659,8 @@ const char *sim_uname (UNIT *uptr)
DEVICE *d; DEVICE *d;
char uname[CBUFSIZE]; char uname[CBUFSIZE];
if (!uptr)
return "";
if (uptr->uname) if (uptr->uname)
return uptr->uname; return uptr->uname;
d = find_dev_from_unit(uptr); d = find_dev_from_unit(uptr);

View file

@ -391,6 +391,7 @@ t_bool is_available;
if (!(uptr->flags & UNIT_ATT)) /* attached? */ if (!(uptr->flags & UNIT_ATT)) /* attached? */
return FALSE; return FALSE;
ctx = (struct disk_context *)uptr->disk_ctx;
switch (DK_GET_FMT (uptr)) { /* case on format */ switch (DK_GET_FMT (uptr)) { /* case on format */
case DKUF_F_STD: /* SIMH format */ case DKUF_F_STD: /* SIMH format */
is_available = TRUE; is_available = TRUE;
@ -399,8 +400,6 @@ switch (DK_GET_FMT (uptr)) { /* case on format */
is_available = TRUE; is_available = TRUE;
break; break;
case DKUF_F_RAW: /* Raw Physical Disk Access */ case DKUF_F_RAW: /* Raw Physical Disk Access */
ctx = (struct disk_context *)uptr->disk_ctx;
if (sim_os_disk_isavailable_raw (uptr->fileref)) { if (sim_os_disk_isavailable_raw (uptr->fileref)) {
if (ctx->media_removed) { if (ctx->media_removed) {
int32 saved_switches = sim_switches; int32 saved_switches = sim_switches;