treewide: Fix various compiler warnings
LTO is currently hiding these warnings.
Change-Id: I09560dfbb150f43d58f472e7592fc0c072e3cc29
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/chassishandler.cpp b/chassishandler.cpp
index de00a26..be0c4c1 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -490,10 +490,12 @@
"Error in prefix getting of setHostNetworkData");
return ipmi::ccReqDataLenInvalid;
}
- std::copy(msgPayloadStartingPos + prefixOffset,
- (msgPayloadStartingPos + prefixOffset +
- sizeof(decltype(prefix))),
- &prefix);
+ // std::copy(msgPayloadStartingPos + prefixOffset,
+ // msgPayloadStartingPos + prefixOffset +
+ // sizeof(decltype(prefix)),
+ // &prefix);
+ // Workaround compiler misdetecting out of bounds memcpy
+ prefix = msgPayloadStartingPos[prefixOffset];
uint8_t gatewayOffset = prefixOffset + sizeof(decltype(prefix));
if (addrSize != ipmi::network::IPV4_ADDRESS_SIZE_BYTE)
diff --git a/selutility.cpp b/selutility.cpp
index 8d327d2..3473814 100644
--- a/selutility.cpp
+++ b/selutility.cpp
@@ -81,7 +81,7 @@
int convert(const std::string_view& str, int base = 10)
{
- int ret;
+ int ret = 0;
std::from_chars(str.data(), str.data() + str.size(), ret, base);
return ret;
}
diff --git a/test/message/unpack.cpp b/test/message/unpack.cpp
index 66c890a..644d2d3 100644
--- a/test/message/unpack.cpp
+++ b/test/message/unpack.cpp
@@ -805,11 +805,7 @@
ipmi::SecureBuffer i = {0x02, 0x04, 0x06, 0x11, 0x22, 0x33, 0x44, 0x55,
0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc};
ipmi::message::Payload p(std::forward<ipmi::SecureBuffer>(i));
- uint8_t v1;
- uint16_t v2;
- uint32_t v3;
- uint64_t v4;
- auto v = std::make_tuple(v1, v2, v3, v4);
+ std::tuple<uint8_t, uint16_t, uint32_t, uint64_t> v;
// check that the number of bytes matches
ASSERT_EQ(p.unpack(v), 0);
// check that the payload was fully unpacked
diff --git a/user_channel/channelcommands.cpp b/user_channel/channelcommands.cpp
index 02a50ce..e860506 100644
--- a/user_channel/channelcommands.cpp
+++ b/user_channel/channelcommands.cpp
@@ -197,7 +197,7 @@
ChannelAccess chAccess;
- Cc compCode;
+ Cc compCode = ipmi::ccUnspecifiedError;
if (types::enum_cast<EChannelActionType>(accessSetMode) == nvData)
{