public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] habanalabs: avoid using uninitialized pointer
@ 2021-05-06  6:53 Oded Gabbay
  2021-05-06  6:53 ` [PATCH 2/3] habanalabs: read f/w's 2-nd sts and err registers Oded Gabbay
  2021-05-06  6:53 ` [PATCH 3/3] habanalabs/gaudi: use scratchpad regs instead of GIC controller Oded Gabbay
  0 siblings, 2 replies; 3+ messages in thread
From: Oded Gabbay @ 2021-05-06  6:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ohad Sharabi

From: Ohad Sharabi <osharabi@habana.ai>

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>
---
 drivers/misc/habanalabs/common/firmware_if.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/habanalabs/common/firmware_if.c b/drivers/misc/habanalabs/common/firmware_if.c
index 5ab755a2e95f..ad9bfa096bf9 100644
--- a/drivers/misc/habanalabs/common/firmware_if.c
+++ b/drivers/misc/habanalabs/common/firmware_if.c
@@ -1565,6 +1565,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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-06  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-06  6:53 [PATCH 1/3] habanalabs: avoid using uninitialized pointer Oded Gabbay
2021-05-06  6:53 ` [PATCH 2/3] habanalabs: read f/w's 2-nd sts and err registers Oded Gabbay
2021-05-06  6:53 ` [PATCH 3/3] habanalabs/gaudi: use scratchpad regs instead of GIC controller Oded Gabbay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox