| commit | a7afacc4fa5ee4da5b10b2fd47e29a6342460a99 | [log] [tgz] |
|---|---|---|
| author | Andrew Jeffery <andrew@aj.id.au> | Thu Mar 31 11:21:28 2022 +1030 |
| committer | Andrew Jeffery <andrew@aj.id.au> | Fri Apr 01 09:43:18 2022 +1030 |
| tree | c343e0e8d410a3c0fabd579d45bfb6114fbfa989 | |
| parent | 7aeb1a5e2b573a8c7ecd2f3da86a90fe0eb42f4b [diff] |
NVMeBasicContext: Fix response vector size
73030639a5ba ("Enable cppcoreguidelines-avoid-goto checks") switches
from passing the backing store of the response vector to ::write() to
using an iterator over the response vector. This exposed the flaw that
the vector was never properly sized to accommodate the presence of the
response in the backing buffer[1], though from a memory-safety
perspective the backing buffer _was_ appropriately sized from the
reserve() call.
Resize the vector both before and after to ensure that a complete
response can be captured safely while also returning a vector that is
sized in accordance with the response.
It's likely the buffer management strategy could be improved here by
instead using std::array and std::span[2].
[1] https://github.com/openbmc/dbus-sensors/issues/18
[2] https://discord.com/channels/775381525260664832/867820390406422538/959228526811312169
Fixes: #18
Fixes: 73030639a5ba ("Enable cppcoreguidelines-avoid-goto checks")
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ic2015a776389635765972084de75e33e7ea23d53
dbus-sensors is a collection of sensor applications that provide the xyz.openbmc_project.Sensor collection of interfaces. They read sensor values from hwmon, d-bus, or direct driver access to provide readings. Some advance non-sensor features such as fan presence, pwm control, and automatic cpu detection (x86) are also supported.
runtime re-configurable from d-bus (entity-manager or the like)
isolated: each sensor type is isolated into its own daemon, so a bug in one sensor is unlikely to affect another, and single sensor modifications are possible
async single-threaded: uses sdbusplus/asio bindings
multiple data inputs: hwmon, d-bus, direct driver access