summaryrefslogtreecommitdiff
path: root/drivers/misc/ntsync.c
diff options
context:
space:
mode:
authorThomas Hellström <thomas.hellstrom@linux.intel.com>2025-03-19 11:08:52 +0100
committerThomas Hellström <thomas.hellstrom@linux.intel.com>2025-03-19 11:08:52 +0100
commit52eb8cd788f1a56a0645c1f6650e5795e04aaed0 (patch)
tree1d61fd7dbe5e7540e972069349b95ac65cd36880 /drivers/misc/ntsync.c
parent28f79ac609de2797cccdd5fa6c4d5ec8bcef92b4 (diff)
parent5da39dce1fa3c81dc6552a16a9f748ba2980d630 (diff)
Merge drm/drm-next into drm-xe-next
Backmerging to bring in the xe shrinker from drm-next. Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Diffstat (limited to 'drivers/misc/ntsync.c')
-rw-r--r--drivers/misc/ntsync.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c
index 055395cde42b6..999026a1ae048 100644
--- a/drivers/misc/ntsync.c
+++ b/drivers/misc/ntsync.c
@@ -873,6 +873,7 @@ static int setup_wait(struct ntsync_device *dev,
{
int fds[NTSYNC_MAX_WAIT_COUNT + 1];
const __u32 count = args->count;
+ size_t size = array_size(count, sizeof(fds[0]));
struct ntsync_q *q;
__u32 total_count;
__u32 i, j;
@@ -880,15 +881,14 @@ static int setup_wait(struct ntsync_device *dev,
if (args->pad || (args->flags & ~NTSYNC_WAIT_REALTIME))
return -EINVAL;
- if (args->count > NTSYNC_MAX_WAIT_COUNT)
+ if (size >= sizeof(fds))
return -EINVAL;
total_count = count;
if (args->alert)
total_count++;
- if (copy_from_user(fds, u64_to_user_ptr(args->objs),
- array_size(count, sizeof(*fds))))
+ if (copy_from_user(fds, u64_to_user_ptr(args->objs), size))
return -EFAULT;
if (args->alert)
fds[count] = args->alert;
@@ -1208,6 +1208,7 @@ static struct miscdevice ntsync_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = NTSYNC_NAME,
.fops = &ntsync_fops,
+ .mode = 0666,
};
module_misc_device(ntsync_misc);