Fixed a number of uses of uninitialized variables by adding assertions
or other sanity checks, code reshuffling, or fixing broken behavior.
This commit is contained in:
@@ -945,8 +945,8 @@ PRIVATE int init_buffers(sub_dev_t *sub_dev_ptr)
|
||||
if (!(sub_dev_ptr->ExtraBuf = malloc(sub_dev_ptr->NrOfExtraBuffers *
|
||||
sub_dev_ptr->DmaSize /
|
||||
sub_dev_ptr->NrOfDmaFragments))) {
|
||||
error("%s failed to allocate extra buffer for channel %d\n",
|
||||
drv.DriverName,i);
|
||||
error("%s failed to allocate extra buffer for a channel\n",
|
||||
drv.DriverName);
|
||||
return EIO;
|
||||
}
|
||||
|
||||
|
||||
@@ -642,18 +642,18 @@ unsigned nr_req; /* length of request vector */
|
||||
if (*up != NO_OFFSET) break;
|
||||
fp->fl_sector++;
|
||||
}
|
||||
}
|
||||
|
||||
if (r == OK && opcode == DEV_SCATTER_S) {
|
||||
/* Copy the user bytes to the DMA buffer. */
|
||||
if(proc_nr != SELF) {
|
||||
s=sys_safecopyfrom(proc_nr, *ug, *up,
|
||||
(vir_bytes) floppy_buf,
|
||||
(phys_bytes) SECTOR_SIZE, D);
|
||||
if(s != OK)
|
||||
panic("FLOPPY", "sys_safecopyfrom failed", s);
|
||||
} else {
|
||||
memcpy(floppy_buf, (void *) (*ug + *up), SECTOR_SIZE);
|
||||
if (opcode == DEV_SCATTER_S) {
|
||||
/* Copy the user bytes to the DMA buffer. */
|
||||
if(proc_nr != SELF) {
|
||||
s=sys_safecopyfrom(proc_nr, *ug, *up,
|
||||
(vir_bytes) floppy_buf,
|
||||
(phys_bytes) SECTOR_SIZE, D);
|
||||
if(s != OK)
|
||||
panic("FLOPPY", "sys_safecopyfrom failed", s);
|
||||
} else {
|
||||
memcpy(floppy_buf, (void *) (*ug + *up), SECTOR_SIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user