Allow any NSM message type (0-255) for RF raw command Fixes nvbug https://nvbugspro.nvidia.com/ Signed-off-by: Utkarsh Yadav <uyadav@nvidia.com>
diff --git a/nsmd/nsmRawCommand/nsmRawCommandHandler.cpp b/nsmd/nsmRawCommand/nsmRawCommandHandler.cpp index 785cd58..865ada6 100644 --- a/nsmd/nsmRawCommand/nsmRawCommandHandler.cpp +++ b/nsmd/nsmRawCommand/nsmRawCommandHandler.cpp
@@ -363,7 +363,9 @@ bool isLongRunning, uint8_t messageType, uint8_t commandCode, sdbusplus::message::unix_fd fd, uint8_t msgFormatVersion) { - if (deviceType > NSM_DEV_ID_CPU || messageType > NSM_TYPE_FIRMWARE) + // Raw command allows any NSM message type (0-255); only deviceType is + // validated against known NSM device IDs. + if (deviceType > NSM_DEV_ID_CPU) { lg2::error( "NsmRawCommandHandler::sendRequest failed: deviceType={DEVICE_TYPE}, deviceRole={DEVICE_ROLE}, instanceId={INSTANCE_ID}, isLongRunning={IS_LONG_RUNNING}, messageType={MESSAGE_TYPE}, commandCode={COMMAND_CODE}",
diff --git a/nsmd/nsmRawCommand/test/nsmRawCommandHandler_test.cpp b/nsmd/nsmRawCommand/test/nsmRawCommandHandler_test.cpp index e0caac7..b563b3a 100644 --- a/nsmd/nsmRawCommand/test/nsmRawCommandHandler_test.cpp +++ b/nsmd/nsmRawCommand/test/nsmRawCommandHandler_test.cpp
@@ -91,10 +91,6 @@ NsmRawCommandHandler::getInstance().sendRequest( NSM_DEV_ID_UNKNOWN, 0, 0, false, 0, 0, unix_fd(fd), 1), sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument); - EXPECT_THROW( - NsmRawCommandHandler::getInstance().sendRequest( - 0, 0, 0, false, NSM_TYPE_FIRMWARE + 1, 0, unix_fd(fd), 1), - sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument); } TEST_F(NsmRawCommandHandlerTest, BadTestNoDevice)