summaryrefslogtreecommitdiffstats
path: root/include/ipmid/message/unpack.hpp
Commit message (Collapse)AuthorAgeFilesLines
* fix logic error for unpack vector of tupleVernon Mauery2019-09-161-5/+8
| | | | | | | | | | | | | | | | | | | | | Unpacking a vector of tuples is failing if the correct number of bytes does not match an integral number of bytes needed to fully unpack all the tuples. Unpacking a tuple should return an error if it does not fully unpack all the items. This will signal the vector unpack to bail and return however many items it has unpacked to that point. A vector unpack should always return success because no matter how many items it has unpacked, it is fine, because a vector can have any number of items. Tested: Unit tests updated to check for proper unpacking of vectors and tuples (and optionals) as well as new unit tests added for more targetted testing. Change-Id: I4b45198f8bc4a49913beb923d10079983179402a Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* unpack static assert on unsupported typesVernon Mauery2019-05-301-17/+20
| | | | | | | | | | | | | | | | | Unsupported types might not cause compile time errors but can result in SIGILL errors at runtime when compiler warnings are ignored. This was found when compiling an intel-ipmi-oem handler that attempted to unpack an enum class type. The code compiles down to an empty function (no return statement or value), which can result in all sorts of undefined behavior. This change forces the unsupported types to emit a static assert and fail to compile. Tested: Created a handler that requests an enum class as an input and saw that the build fails with a static assert. Change-Id: I123da15cb001756f07761cf7a60b799469926a2a Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* message/payload: Clean up check / trailing stateWilliam A. Kennington III2019-04-291-5/+1
| | | | | | | | | | | | | | | | We want to be able to trivially re-use payloads for marshalling data from a buffer into other formats. This change tries to make the meaning of trailingOk and unpackCheck consistent, since the meanings didn't seem clear in the previous code. Now, unpackCheck is only used to determine if unpacking was checked, and trailingOk determines if unpackCheck is required. This also fixes lots of spurious warnings being printed for commands which were checking their output correctly, or were legacy and unable to check output. Change-Id: Id7aa9266693b4e3f896027acf6b3e5d757fdf981 Signed-off-by: William A. Kennington III <wak@google.com>
* message/unpack: Fix undefined behaviorWilliam A. Kennington III2019-04-111-1/+3
| | | | | | | | | | | | | It's UB to shift an integer by the size of that integer. More specifically, if you disable compiler optimization and try and unpack a 32 bit bitset you will end up with a 0x0 mask. Avoid UB by replacing shift subtract with a negate shift. Tested: Unit tests pass now. Change-Id: I03a6f866a51c955b57787d641da9180841747e4c Signed-off-by: William A. Kennington III <wak@google.com>
* ipmid: Compiler-generated unpacking and packing of messagesVernon Mauery2019-02-251-0/+340
handler.hpp has the templated wrapping bits for ipmi command handler callbacks implemented. message.hpp has the serialization/deserialization of the ipmi data stream into packed tuples for functions. message/pack.hpp and message/unpack.hpp contain the actual serialization and deserialization of types. Change-Id: If997f8768c8488ab6ac022526a5ef9a1bce57fcb Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
OpenPOWER on IntegriCloud