diff options
author | Ohad Sharabi <osharabi@habana.ai> | 2021-05-03 09:44:22 +0300 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2021-06-18 15:23:39 +0300 |
commit | ea7d5e7b102bf0bd41eef1faa6b2337e45791a62 (patch) | |
tree | bea01cdd8ec39d8da1e826a79f30ec07bdd6ecd4 | |
parent | 6542c3541d0f9405626faff9509aa28671fc3804 (diff) |
habanalabs: avoid using uninitialized pointer
When attempting to read FW component's version we should break if input
FW component is invalid in order to avoid using uninitialized
destination pointer.
Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
-rw-r--r-- | drivers/misc/habanalabs/common/firmware_if.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c index 03e26a1fd9c1..e0fe2d5d4c57 100644 --- a/drivers/misc/habanalabs/common/firmware_if.c +++ b/drivers/misc/habanalabs/common/firmware_if.c @@ -1566,6 +1566,7 @@ static void hl_fw_dynamic_read_device_fw_version(struct hl_device *hdev, break; default: dev_warn(hdev->dev, "Undefined FW component: %d\n", fwc); + return; } strscpy(dest, fw_version, VERSION_MAX_LEN); |