Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
7c35666d
Commit
7c35666d
authored
Jul 18, 2003
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PPC32: Change mm_segment_t definitions to simplify the code.
parent
a55f8631
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
include/asm-ppc/uaccess.h
include/asm-ppc/uaccess.h
+12
-8
No files found.
include/asm-ppc/uaccess.h
View file @
7c35666d
...
...
@@ -16,10 +16,13 @@
* get_fs() == KERNEL_DS, checking is bypassed.
*
* For historical reasons, these macros are grossly misnamed.
*
* The fs/ds values are now the highest legal address in the "segment".
* This simplifies the checking in the routines below.
*/
#define KERNEL_DS ((mm_segment_t) {
0
})
#define USER_DS ((mm_segment_t) { 1 })
#define KERNEL_DS ((mm_segment_t) {
~0UL
})
#define USER_DS ((mm_segment_t) {
TASK_SIZE -
1 })
#define get_ds() (KERNEL_DS)
#define get_fs() (current->thread.fs)
...
...
@@ -27,14 +30,15 @@
#define segment_eq(a,b) ((a).seg == (b).seg)
#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS))
#define __user_ok(addr,size) (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size)))
#define __access_ok(addr,size) (__kernel_ok || __user_ok((addr),(size)))
#define access_ok(type,addr,size) __access_ok((unsigned long)(addr),(size))
#define __access_ok(addr,size) \
((addr) <= current->thread.fs.seg \
&& ((size) == 0 || (size) - 1 <= current->thread.fs.seg - (addr)))
#define access_ok(type, addr, size) __access_ok((unsigned long)(addr),(size))
extern
inline
int
verify_area
(
int
type
,
const
void
__user
*
addr
,
unsigned
long
size
)
{
return
access_ok
(
type
,
addr
,
size
)
?
0
:
-
EFAULT
;
return
access_ok
(
type
,
addr
,
size
)
?
0
:
-
EFAULT
;
}
...
...
@@ -303,7 +307,7 @@ extern int __strnlen_user(const char __user *str, long len, unsigned long top);
*/
extern
__inline__
int
strnlen_user
(
const
char
__user
*
str
,
long
len
)
{
unsigned
long
top
=
__kernel_ok
?
~
0UL
:
TASK_SIZE
-
1
;
unsigned
long
top
=
current
->
thread
.
fs
.
seg
;
if
((
unsigned
long
)
str
>
top
)
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment