lkml.org 
[lkml]   [2020]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v4 01/13] ptrace: Use regset_size() for dynamic regset size.
Date
It uses regset_size() instead of using regset->n and regset->size directly.
In this case, it will call the get_size() ported by arch dynamically to
support dynamic regset size case.

Signed-off-by: Greentime Hu <greentime.hu@sifive.com>
---
kernel/ptrace.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 43d6179508d6..6877105e1b1e 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -882,13 +882,18 @@ static int ptrace_regset(struct task_struct *task, int req, unsigned int type,
const struct user_regset_view *view = task_user_regset_view(task);
const struct user_regset *regset = find_regset(view, type);
int regset_no;
+ unsigned int size;

- if (!regset || (kiov->iov_len % regset->size) != 0)
+ if (!regset)
return -EINVAL;

regset_no = regset - view->regsets;
- kiov->iov_len = min(kiov->iov_len,
- (__kernel_size_t) (regset->n * regset->size));
+ size = regset_size(task, regset);
+
+ if ((kiov->iov_len % size) != 0)
+ return -EINVAL;
+
+ kiov->iov_len = min(kiov->iov_len, (__kernel_size_t) size);

if (req == PTRACE_GETREGSET)
return copy_regset_to_user(task, view, regset_no, 0,
--
2.26.2
\
 
 \ /
  Last update: 2020-05-26 09:03    [W:0.221 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site