aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2006-12-04 09:40:02 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2006-12-04 09:40:02 -0500
commit654452a48aa2bbfa276016a1e35d8988ff991ebb (patch)
tree513f3469f04440b6c3a3ef47bb6810ce1c381c3f /include
parentbba125a6116e51faff98df1906bf77d06b644aea (diff)
[S390] termio <-> termios conversion error handling.
Get rid of our own user_termio_to_kernel_termios() and kernel_termios_to_user_termio() macros which didn't check for errors on user space accesses. Instead use the generic functions which handle this properly. In addition the generic version of user_termio_to_kernel_termios() also copies the c_line member which was missing in our variant. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-s390/termios.h34
1 files changed, 1 insertions, 33 deletions
diff --git a/include/asm-s390/termios.h b/include/asm-s390/termios.h
index d1e29cca54c9..62b23caf370e 100644
--- a/include/asm-s390/termios.h
+++ b/include/asm-s390/termios.h
@@ -75,39 +75,7 @@ struct termio {
75*/ 75*/
76#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" 76#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
77 77
78/* 78#include <asm-generic/termios.h>
79 * Translate a "termio" structure into a "termios". Ugh.
80 */
81#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \
82 unsigned short __tmp; \
83 get_user(__tmp,&(termio)->x); \
84 (termios)->x = (0xffff0000 & ((termios)->x)) | __tmp; \
85}
86
87#define user_termio_to_kernel_termios(termios, termio) \
88({ \
89 SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
90 SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
91 SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
92 SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
93 copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
94})
95
96/*
97 * Translate a "termios" structure into a "termio". Ugh.
98 */
99#define kernel_termios_to_user_termio(termio, termios) \
100({ \
101 put_user((termios)->c_iflag, &(termio)->c_iflag); \
102 put_user((termios)->c_oflag, &(termio)->c_oflag); \
103 put_user((termios)->c_cflag, &(termio)->c_cflag); \
104 put_user((termios)->c_lflag, &(termio)->c_lflag); \
105 put_user((termios)->c_line, &(termio)->c_line); \
106 copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
107})
108
109#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios))
110#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios))
111 79
112#endif /* __KERNEL__ */ 80#endif /* __KERNEL__ */
113 81