coverity suggestions; nbd disk-backend garbage output fix
This commit is contained in:
parent
bccf8c69cf
commit
1c03260f37
3 changed files with 7 additions and 4 deletions
|
@ -79,7 +79,7 @@ std::pair<breakpoint_register *, std::optional<std::string> > breakpoint_registe
|
||||||
return { nullptr, "register: key or value missing" };
|
return { nullptr, "register: key or value missing" };
|
||||||
|
|
||||||
auto values_in = parts.at(1);
|
auto values_in = parts.at(1);
|
||||||
auto v_parts = split(values_in, ",");
|
auto v_parts = split(std::move(values_in), ",");
|
||||||
std::set<uint16_t> values;
|
std::set<uint16_t> values;
|
||||||
for(auto & v: v_parts)
|
for(auto & v: v_parts)
|
||||||
values.insert(std::stoi(v, nullptr, 8));
|
values.insert(std::stoi(v, nullptr, 8));
|
||||||
|
|
4
cpu.cpp
4
cpu.cpp
|
@ -346,6 +346,8 @@ bool cpu::check_pending_interrupts() const
|
||||||
for(uint8_t i=start_level; i < 8; i++) {
|
for(uint8_t i=start_level; i < 8; i++) {
|
||||||
auto interrupts = queued_interrupts.find(i);
|
auto interrupts = queued_interrupts.find(i);
|
||||||
|
|
||||||
|
assert(interrupts != queued_interrupts.end());
|
||||||
|
|
||||||
if (interrupts->second.empty() == false)
|
if (interrupts->second.empty() == false)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2316,7 +2318,7 @@ std::map<std::string, std::vector<std::string> > cpu::disassemble(const uint16_t
|
||||||
// PSW
|
// PSW
|
||||||
std::string psw_str = format("%d%d|%d|%d|%c%c%c%c%c", psw >> 14, (psw >> 12) & 3, (psw >> 11) & 1, (psw >> 5) & 7,
|
std::string psw_str = format("%d%d|%d|%d|%c%c%c%c%c", psw >> 14, (psw >> 12) & 3, (psw >> 11) & 1, (psw >> 5) & 7,
|
||||||
psw & 16?'t':'-', psw & 8?'n':'-', psw & 4?'z':'-', psw & 2 ? 'v':'-', psw & 1 ? 'c':'-');
|
psw & 16?'t':'-', psw & 8?'n':'-', psw & 4?'z':'-', psw & 2 ? 'v':'-', psw & 1 ? 'c':'-');
|
||||||
out.insert({ "psw", { psw_str } });
|
out.insert({ "psw", { std::move(psw_str) } });
|
||||||
out.insert({ "psw-value", { format("%06o", psw) } });
|
out.insert({ "psw-value", { format("%06o", psw) } });
|
||||||
|
|
||||||
// values worked with
|
// values worked with
|
||||||
|
|
|
@ -119,12 +119,13 @@ bool disk_backend_nbd::connect(const bool retry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(nbd_hello.magic1, "NBDMAGIC", 8) != 0) {
|
if (fd != -1 && memcmp(nbd_hello.magic1, "NBDMAGIC", 8) != 0) {
|
||||||
close(fd);
|
close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
DOLOG(warning, true, "disk_backend_nbd::connect: magic invalid");
|
DOLOG(warning, true, "disk_backend_nbd::connect: magic invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fd != -1)
|
||||||
DOLOG(info, false, "NBD size: %u", NTOHLL(nbd_hello.size));
|
DOLOG(info, false, "NBD size: %u", NTOHLL(nbd_hello.size));
|
||||||
}
|
}
|
||||||
while(fd == -1 && retry);
|
while(fd == -1 && retry);
|
||||||
|
|
Loading…
Add table
Reference in a new issue