scsibus: Check for invalid target_id.

This commit is contained in:
joevt 2024-04-22 00:27:41 -07:00 committed by dingusdev
parent 2c79171be6
commit bc691a9d86

View File

@ -286,12 +286,22 @@ int ScsiBus::target_xfer_data() {
void ScsiBus::target_next_step() void ScsiBus::target_next_step()
{ {
if (target_id < 0) {
LOG_F(ERROR, "%s: target_id is not set yet.", this->get_name().c_str());
}
else {
this->devices[this->target_id]->next_step(); this->devices[this->target_id]->next_step();
}
} }
bool ScsiBus::negotiate_xfer(int& bytes_in, int& bytes_out) bool ScsiBus::negotiate_xfer(int& bytes_in, int& bytes_out)
{ {
if (target_id < 0) {
LOG_F(ERROR, "%s: target_id is not set yet.", this->get_name().c_str());
}
else {
this->devices[this->target_id]->prepare_xfer(this, bytes_in, bytes_out); this->devices[this->target_id]->prepare_xfer(this, bytes_in, bytes_out);
}
return true; return true;
} }