misc: Another round of static analysis fixups

Mostly addressing uninitialised members.
This commit is contained in:
Andreas Hansson 2014-11-24 09:03:38 -05:00
parent 1f539f13c3
commit d66b14ca61
10 changed files with 21 additions and 23 deletions

View file

@ -39,13 +39,10 @@
struct m5_twin64_t {
uint64_t a;
uint64_t b;
m5_twin64_t()
m5_twin64_t() : a(0), b(0)
{}
m5_twin64_t(const uint64_t x) : a(x), b(x)
{}
m5_twin64_t(const uint64_t x)
{
a = x;
b = x;
}
inline m5_twin64_t& operator=(const uint64_t x)
{
a = x;

View file

@ -658,12 +658,13 @@ BaseRemoteGDB::trap(int type)
* After the debugger is "active" (connected) it will be
* waiting for a "signaled" message from us.
*/
if (!active)
if (!active) {
active = true;
else
} else {
// Tell remote host that an exception has occurred.
snprintf((char *)buffer, bufferSize, "S%02x", type);
send(buffer);
}
// Stick frame regs into our reg cache.
getregs();

View file

@ -43,7 +43,8 @@
VirtDescriptor::VirtDescriptor(PortProxy &_memProxy, VirtQueue &_queue,
Index descIndex)
: memProxy(&_memProxy), queue(&_queue), _index(descIndex)
: memProxy(&_memProxy), queue(&_queue), _index(descIndex),
desc{0, 0, 0, 0}
{
}

View file

@ -479,7 +479,7 @@ public:
} M5_ATTR_PACKED;
VirtRing<T>(PortProxy &proxy, uint16_t size)
: ring(size), _proxy(proxy), _base(0) {}
: header{0, 0}, ring(size), _proxy(proxy), _base(0) {}
/**
* Set the base address of the VirtIO ring buffer.

View file

@ -291,7 +291,7 @@ VirtIO9PProxy::writeAll(const uint8_t *data, size_t len)
VirtIO9PDiod::VirtIO9PDiod(Params *params)
: VirtIO9PProxy(params),
fd_to_diod(-1), fd_from_diod(-1)
fd_to_diod(-1), fd_from_diod(-1), diod_pid(-1)
{
}

View file

@ -43,8 +43,8 @@
#include "params/PciVirtIO.hh"
PciVirtIO::PciVirtIO(const Params *params)
: PciDevice(params), vio(*params->vio),
callbackKick(this)
: PciDevice(params), queueNotify(0), interruptDeliveryPending(false),
vio(*params->vio), callbackKick(this)
{
// Override the subsystem ID with the device ID from VirtIO
config.subsystemID = htole(vio.deviceId);

View file

@ -73,7 +73,7 @@ class StubSlavePort : public ExternalSlave::Port
StubSlavePort(const std::string &name_,
ExternalSlave &owner_) :
ExternalSlave::Port(name_, owner_),
responseEvent(*this), responsePacket(NULL)
responseEvent(*this), responsePacket(NULL), mustRetry(false)
{ }
Tick recvAtomic(PacketPtr packet);

View file

@ -94,13 +94,10 @@ class InstRecord
: when(_when), thread(_thread),
staticInst(_staticInst), pc(_pc),
macroStaticInst(_macroStaticInst),
misspeculating(spec), predicate(true)
misspeculating(spec), predicate(true), addr(0), addr_valid(false),
data_status(DataInvalid),
fetch_seq(0), fetch_seq_valid(false), cp_seq(0), cp_seq_valid(false)
{
data_status = DataInvalid;
addr_valid = false;
fetch_seq_valid = false;
cp_seq_valid = false;
}
virtual ~InstRecord() { }

View file

@ -104,7 +104,9 @@ template struct AuxVector<uint64_t>;
Process::Process(ProcessParams * params)
: SimObject(params), system(params->system),
brk_point(0), stack_base(0), stack_size(0), stack_min(0),
max_stack_size(params->max_stack_size),
next_thread_stack_base(0),
M5_pid(system->allocatePID()),
useArchPT(params->useArchPT),
kvmInSE(params->kvmInSE),

View file

@ -228,6 +228,7 @@ readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
int index = 0;
int fd = p->sim_fd(p->getSyscallArg(tc, index));
assert(fd >= 0);
Addr bufPtr = p->getSyscallArg(tc, index);
int nbytes = p->getSyscallArg(tc, index);
BufferArg bufArg(bufPtr, nbytes);
@ -264,6 +265,7 @@ lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
int index = 0;
int fd = p->sim_fd(p->getSyscallArg(tc, index));
assert(fd >= 0);
uint64_t offs = p->getSyscallArg(tc, index);
int whence = p->getSyscallArg(tc, index);
@ -278,6 +280,7 @@ _llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
{
int index = 0;
int fd = p->sim_fd(p->getSyscallArg(tc, index));
assert(fd >= 0);
uint64_t offset_high = p->getSyscallArg(tc, index);
uint32_t offset_low = p->getSyscallArg(tc, index);
Addr result_ptr = p->getSyscallArg(tc, index);
@ -301,9 +304,6 @@ _llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
result_buf.copyOut(tc->getMemProxy());
return 0;
}
return (result == (off_t)-1) ? -errno : result;
}