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
Kirill Smelkov
linux
Commits
e55c57e0
Commit
e55c57e0
authored
Jun 24, 2005
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC64]: Report any user access faults in termios accessors.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
37616578
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
37 deletions
+41
-37
include/asm-sparc64/termios.h
include/asm-sparc64/termios.h
+41
-37
No files found.
include/asm-sparc64/termios.h
View file @
e55c57e0
...
@@ -100,16 +100,17 @@ struct winsize {
...
@@ -100,16 +100,17 @@ struct winsize {
#define user_termio_to_kernel_termios(termios, termio) \
#define user_termio_to_kernel_termios(termios, termio) \
({ \
({ \
unsigned short tmp; \
unsigned short tmp; \
get_user(tmp, &(termio)->c_iflag); \
int err; \
err = get_user(tmp, &(termio)->c_iflag); \
(termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
(termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
get_user(tmp, &(termio)->c_oflag); \
err |=
get_user(tmp, &(termio)->c_oflag); \
(termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
(termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
get_user(tmp, &(termio)->c_cflag); \
err |=
get_user(tmp, &(termio)->c_cflag); \
(termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
(termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
get_user(tmp, &(termio)->c_lflag); \
err |=
get_user(tmp, &(termio)->c_lflag); \
(termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
(termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
err |=
copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
0
; \
err
; \
})
})
/*
/*
...
@@ -119,53 +120,56 @@ struct winsize {
...
@@ -119,53 +120,56 @@ struct winsize {
*/
*/
#define kernel_termios_to_user_termio(termio, termios) \
#define kernel_termios_to_user_termio(termio, termios) \
({ \
({ \
put_user((termios)->c_iflag, &(termio)->c_iflag); \
int err; \
put_user((termios)->c_oflag, &(termio)->c_oflag); \
err = put_user((termios)->c_iflag, &(termio)->c_iflag); \
put_user((termios)->c_cflag, &(termio)->c_cflag); \
err |= put_user((termios)->c_oflag, &(termio)->c_oflag); \
put_user((termios)->c_lflag, &(termio)->c_lflag); \
err |= put_user((termios)->c_cflag, &(termio)->c_cflag); \
put_user((termios)->c_line, &(termio)->c_line); \
err |= put_user((termios)->c_lflag, &(termio)->c_lflag); \
copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
err |= put_user((termios)->c_line, &(termio)->c_line); \
err |= copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
if (!((termios)->c_lflag & ICANON)) { \
if (!((termios)->c_lflag & ICANON)) { \
put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \
err |=
put_user((termios)->c_cc[VMIN], &(termio)->c_cc[_VMIN]); \
put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \
err |=
put_user((termios)->c_cc[VTIME], &(termio)->c_cc[_VTIME]); \
} \
} \
0
; \
err
; \
})
})
#define user_termios_to_kernel_termios(k, u) \
#define user_termios_to_kernel_termios(k, u) \
({ \
({ \
get_user((k)->c_iflag, &(u)->c_iflag); \
int err; \
get_user((k)->c_oflag, &(u)->c_oflag); \
err = get_user((k)->c_iflag, &(u)->c_iflag); \
get_user((k)->c_cflag, &(u)->c_cflag); \
err |= get_user((k)->c_oflag, &(u)->c_oflag); \
get_user((k)->c_lflag, &(u)->c_lflag); \
err |= get_user((k)->c_cflag, &(u)->c_cflag); \
get_user((k)->c_line, &(u)->c_line); \
err |= get_user((k)->c_lflag, &(u)->c_lflag); \
copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
err |= get_user((k)->c_line, &(u)->c_line); \
err |= copy_from_user((k)->c_cc, (u)->c_cc, NCCS); \
if((k)->c_lflag & ICANON) { \
if((k)->c_lflag & ICANON) { \
get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
err |=
get_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
err |=
get_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
} else { \
} else { \
get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
err |=
get_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
err |=
get_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
} \
} \
0
; \
err
; \
})
})
#define kernel_termios_to_user_termios(u, k) \
#define kernel_termios_to_user_termios(u, k) \
({ \
({ \
put_user((k)->c_iflag, &(u)->c_iflag); \
int err; \
put_user((k)->c_oflag, &(u)->c_oflag); \
err = put_user((k)->c_iflag, &(u)->c_iflag); \
put_user((k)->c_cflag, &(u)->c_cflag); \
err |= put_user((k)->c_oflag, &(u)->c_oflag); \
put_user((k)->c_lflag, &(u)->c_lflag); \
err |= put_user((k)->c_cflag, &(u)->c_cflag); \
put_user((k)->c_line, &(u)->c_line); \
err |= put_user((k)->c_lflag, &(u)->c_lflag); \
copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
err |= put_user((k)->c_line, &(u)->c_line); \
err |= copy_to_user((u)->c_cc, (k)->c_cc, NCCS); \
if(!((k)->c_lflag & ICANON)) { \
if(!((k)->c_lflag & ICANON)) { \
put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
err |=
put_user((k)->c_cc[VMIN], &(u)->c_cc[_VMIN]); \
put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
err |=
put_user((k)->c_cc[VTIME], &(u)->c_cc[_VTIME]); \
} else { \
} else { \
put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
err |=
put_user((k)->c_cc[VEOF], &(u)->c_cc[VEOF]); \
put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
err |=
put_user((k)->c_cc[VEOL], &(u)->c_cc[VEOL]); \
} \
} \
0
; \
err
; \
})
})
#endif
/* __KERNEL__ */
#endif
/* __KERNEL__ */
...
...
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