public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: SW_Drivers@habana.ai
Subject: [PATCH] habanalabs: make sure cs type is valid in cs_ioctl_signal_wait
Date: Wed,  4 Nov 2020 10:36:29 +0200	[thread overview]
Message-ID: <20201104083630.28402-7-ogabbay@kernel.org> (raw)
In-Reply-To: <20201104083630.28402-1-ogabbay@kernel.org>

Although we get a valid cs type from the callee, in case new values
will be added in the future, it is best to check the expected values
in that function.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 drivers/misc/habanalabs/common/command_submission.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index f5bf8684f8aa..46c36b385c95 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -1070,9 +1070,11 @@ static int cs_ioctl_signal_wait(struct hl_fpriv *hpriv, enum hl_cs_type cs_type,
 	if (cs_type == CS_TYPE_WAIT || cs_type == CS_TYPE_SIGNAL)
 		rc = cs_ioctl_signal_wait_create_jobs(hdev, ctx, cs, q_type,
 				q_idx);
-	else
+	else if (cs_type == CS_TYPE_COLLECTIVE_WAIT)
 		rc = hdev->asic_funcs->collective_wait_create_jobs(hdev, ctx,
 				cs, q_idx, collective_engine_id);
+	else
+		rc = -EINVAL;
 
 	if (rc)
 		goto free_cs_object;
-- 
2.17.1


  parent reply	other threads:[~2020-11-04  8:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04  8:36 [PATCH] habanalabs: advanced FW loading Oded Gabbay
2020-11-04  8:36 ` [PATCH 1/2] habanalabs: fetch security indication from FW Oded Gabbay
2020-11-04  8:36 ` [PATCH] habanalabs: fix cs counters structure Oded Gabbay
2020-11-04  8:36 ` [PATCH] habanalabs/gaudi: monitor device memory usage Oded Gabbay
2020-11-04  8:36 ` [PATCH] habanalabs/gaudi: remove unreachable code Oded Gabbay
2020-11-04  8:36 ` [PATCH] habanalabs: initialize variable before use Oded Gabbay
2020-11-04  8:36 ` Oded Gabbay [this message]
2020-11-04  8:36 ` [PATCH 2/2] habanalabs/gaudi: add support for FW security Oded Gabbay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201104083630.28402-7-ogabbay@kernel.org \
    --to=ogabbay@kernel.org \
    --cc=SW_Drivers@habana.ai \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox