summaryrefslogtreecommitdiffstats
path: root/drivers/accel/habanalabs/common/habanalabs_ioctl.c
diff options
context:
space:
mode:
authorfarah kassabri <fkassabri@habana.ai>2023-01-03 13:23:55 +0100
committerOded Gabbay <ogabbay@kernel.org>2023-01-26 10:52:12 +0100
commit72848de04bbac214f927ec2f7f4e16a20161c169 (patch)
treef41dd97204675eb6bd1ff11f8ab12362013866fd /drivers/accel/habanalabs/common/habanalabs_ioctl.c
parenthabanalabs: remove unnecessary (void*) conversions (diff)
downloadlinux-72848de04bbac214f927ec2f7f4e16a20161c169.tar.xz
linux-72848de04bbac214f927ec2f7f4e16a20161c169.zip
habanalabs: check pad and reserved fields in ioctls
Make sure all reserved/pad fields in uapi input structures are set to 0. Signed-off-by: farah kassabri <fkassabri@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/accel/habanalabs/common/habanalabs_ioctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/accel/habanalabs/common/habanalabs_ioctl.c b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
index 72493bf94ba3..5005e6fca691 100644
--- a/drivers/accel/habanalabs/common/habanalabs_ioctl.c
+++ b/drivers/accel/habanalabs/common/habanalabs_ioctl.c
@@ -884,9 +884,13 @@ static int _hl_info_ioctl(struct hl_fpriv *hpriv, void *data,
enum hl_device_status status;
struct hl_info_args *args = data;
struct hl_device *hdev = hpriv->hdev;
-
int rc;
+ if (args->pad) {
+ dev_dbg(hdev->dev, "Padding bytes must be 0\n");
+ return -EINVAL;
+ }
+
/*
* Information is returned for the following opcodes even if the device
* is disabled or in reset.