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
f8ee27f6
Commit
f8ee27f6
authored
May 30, 2004
by
Alexander Viro
Committed by
Linus Torvalds
May 30, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: tty_ioctl annotation
tty_ioctl.c annotation
parent
1b27246b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
31 deletions
+32
-31
drivers/char/tty_ioctl.c
drivers/char/tty_ioctl.c
+32
-31
No files found.
drivers/char/tty_ioctl.c
View file @
f8ee27f6
...
...
@@ -140,7 +140,7 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios
(
*
tty
->
ldisc
.
set_termios
)(
tty
,
&
old_termios
);
}
static
int
set_termios
(
struct
tty_struct
*
tty
,
unsigned
long
arg
,
int
opt
)
static
int
set_termios
(
struct
tty_struct
*
tty
,
void
__user
*
arg
,
int
opt
)
{
struct
termios
tmp_termios
;
int
retval
=
tty_check_change
(
tty
);
...
...
@@ -151,11 +151,11 @@ static int set_termios(struct tty_struct * tty, unsigned long arg, int opt)
if
(
opt
&
TERMIOS_TERMIO
)
{
memcpy
(
&
tmp_termios
,
tty
->
termios
,
sizeof
(
struct
termios
));
if
(
user_termio_to_kernel_termios
(
&
tmp_termios
,
(
struct
termio
*
)
arg
))
(
struct
termio
__user
*
)
arg
))
return
-
EFAULT
;
}
else
{
if
(
user_termios_to_kernel_termios
(
&
tmp_termios
,
(
struct
termios
*
)
arg
))
(
struct
termios
__user
*
)
arg
))
return
-
EFAULT
;
}
...
...
@@ -172,7 +172,7 @@ static int set_termios(struct tty_struct * tty, unsigned long arg, int opt)
return
0
;
}
static
int
get_termio
(
struct
tty_struct
*
tty
,
struct
termio
*
termio
)
static
int
get_termio
(
struct
tty_struct
*
tty
,
struct
termio
__user
*
termio
)
{
if
(
kernel_termios_to_user_termio
(
termio
,
tty
->
termios
))
return
-
EFAULT
;
...
...
@@ -222,7 +222,7 @@ static int get_sgflags(struct tty_struct * tty)
return
flags
;
}
static
int
get_sgttyb
(
struct
tty_struct
*
tty
,
struct
sgttyb
*
sgttyb
)
static
int
get_sgttyb
(
struct
tty_struct
*
tty
,
struct
sgttyb
__user
*
sgttyb
)
{
struct
sgttyb
tmp
;
...
...
@@ -260,7 +260,7 @@ static void set_sgflags(struct termios * termios, int flags)
}
}
static
int
set_sgttyb
(
struct
tty_struct
*
tty
,
struct
sgttyb
*
sgttyb
)
static
int
set_sgttyb
(
struct
tty_struct
*
tty
,
struct
sgttyb
__user
*
sgttyb
)
{
int
retval
;
struct
sgttyb
tmp
;
...
...
@@ -281,7 +281,7 @@ static int set_sgttyb(struct tty_struct * tty, struct sgttyb * sgttyb)
#endif
#ifdef TIOCGETC
static
int
get_tchars
(
struct
tty_struct
*
tty
,
struct
tchars
*
tchars
)
static
int
get_tchars
(
struct
tty_struct
*
tty
,
struct
tchars
__user
*
tchars
)
{
struct
tchars
tmp
;
...
...
@@ -294,7 +294,7 @@ static int get_tchars(struct tty_struct * tty, struct tchars * tchars)
return
copy_to_user
(
tchars
,
&
tmp
,
sizeof
(
tmp
))
?
-
EFAULT
:
0
;
}
static
int
set_tchars
(
struct
tty_struct
*
tty
,
struct
tchars
*
tchars
)
static
int
set_tchars
(
struct
tty_struct
*
tty
,
struct
tchars
__user
*
tchars
)
{
struct
tchars
tmp
;
...
...
@@ -311,7 +311,7 @@ static int set_tchars(struct tty_struct * tty, struct tchars * tchars)
#endif
#ifdef TIOCGLTC
static
int
get_ltchars
(
struct
tty_struct
*
tty
,
struct
ltchars
*
ltchars
)
static
int
get_ltchars
(
struct
tty_struct
*
tty
,
struct
ltchars
__user
*
ltchars
)
{
struct
ltchars
tmp
;
...
...
@@ -324,7 +324,7 @@ static int get_ltchars(struct tty_struct * tty, struct ltchars * ltchars)
return
copy_to_user
(
ltchars
,
&
tmp
,
sizeof
(
tmp
))
?
-
EFAULT
:
0
;
}
static
int
set_ltchars
(
struct
tty_struct
*
tty
,
struct
ltchars
*
ltchars
)
static
int
set_ltchars
(
struct
tty_struct
*
tty
,
struct
ltchars
__user
*
ltchars
)
{
struct
ltchars
tmp
;
...
...
@@ -363,6 +363,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
tty_struct
*
real_tty
;
void
__user
*
p
=
(
void
__user
*
)
arg
;
int
retval
;
if
(
tty
->
driver
->
type
==
TTY_DRIVER_TYPE_PTY
&&
...
...
@@ -374,41 +375,41 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
switch
(
cmd
)
{
#ifdef TIOCGETP
case
TIOCGETP
:
return
get_sgttyb
(
real_tty
,
(
struct
sgttyb
*
)
arg
);
return
get_sgttyb
(
real_tty
,
(
struct
sgttyb
__user
*
)
arg
);
case
TIOCSETP
:
case
TIOCSETN
:
return
set_sgttyb
(
real_tty
,
(
struct
sgttyb
*
)
arg
);
return
set_sgttyb
(
real_tty
,
(
struct
sgttyb
__user
*
)
arg
);
#endif
#ifdef TIOCGETC
case
TIOCGETC
:
return
get_tchars
(
real_tty
,
(
struct
tchars
*
)
arg
);
return
get_tchars
(
real_tty
,
p
);
case
TIOCSETC
:
return
set_tchars
(
real_tty
,
(
struct
tchars
*
)
arg
);
return
set_tchars
(
real_tty
,
p
);
#endif
#ifdef TIOCGLTC
case
TIOCGLTC
:
return
get_ltchars
(
real_tty
,
(
struct
ltchars
*
)
arg
);
return
get_ltchars
(
real_tty
,
p
);
case
TIOCSLTC
:
return
set_ltchars
(
real_tty
,
(
struct
ltchars
*
)
arg
);
return
set_ltchars
(
real_tty
,
p
);
#endif
case
TCGETS
:
if
(
kernel_termios_to_user_termios
((
struct
termios
*
)
arg
,
real_tty
->
termios
))
if
(
kernel_termios_to_user_termios
((
struct
termios
__user
*
)
arg
,
real_tty
->
termios
))
return
-
EFAULT
;
return
0
;
case
TCSETSF
:
return
set_termios
(
real_tty
,
arg
,
TERMIOS_FLUSH
|
TERMIOS_WAIT
);
return
set_termios
(
real_tty
,
p
,
TERMIOS_FLUSH
|
TERMIOS_WAIT
);
case
TCSETSW
:
return
set_termios
(
real_tty
,
arg
,
TERMIOS_WAIT
);
return
set_termios
(
real_tty
,
p
,
TERMIOS_WAIT
);
case
TCSETS
:
return
set_termios
(
real_tty
,
arg
,
0
);
return
set_termios
(
real_tty
,
p
,
0
);
case
TCGETA
:
return
get_termio
(
real_tty
,
(
struct
termio
*
)
arg
);
return
get_termio
(
real_tty
,
p
);
case
TCSETAF
:
return
set_termios
(
real_tty
,
arg
,
TERMIOS_FLUSH
|
TERMIOS_WAIT
|
TERMIOS_TERMIO
);
return
set_termios
(
real_tty
,
p
,
TERMIOS_FLUSH
|
TERMIOS_WAIT
|
TERMIOS_TERMIO
);
case
TCSETAW
:
return
set_termios
(
real_tty
,
arg
,
TERMIOS_WAIT
|
TERMIOS_TERMIO
);
return
set_termios
(
real_tty
,
p
,
TERMIOS_WAIT
|
TERMIOS_TERMIO
);
case
TCSETA
:
return
set_termios
(
real_tty
,
arg
,
TERMIOS_TERMIO
);
return
set_termios
(
real_tty
,
p
,
TERMIOS_TERMIO
);
case
TCXONC
:
retval
=
tty_check_change
(
tty
);
if
(
retval
)
...
...
@@ -462,21 +463,21 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
case
TIOCOUTQ
:
return
put_user
(
tty
->
driver
->
chars_in_buffer
?
tty
->
driver
->
chars_in_buffer
(
tty
)
:
0
,
(
int
*
)
arg
);
(
int
__user
*
)
arg
);
case
TIOCINQ
:
retval
=
tty
->
read_cnt
;
if
(
L_ICANON
(
tty
))
retval
=
inq_canon
(
tty
);
return
put_user
(
retval
,
(
unsigned
int
*
)
arg
);
return
put_user
(
retval
,
(
unsigned
int
__user
*
)
arg
);
case
TIOCGLCKTRMIOS
:
if
(
kernel_termios_to_user_termios
((
struct
termios
*
)
arg
,
real_tty
->
termios_locked
))
if
(
kernel_termios_to_user_termios
((
struct
termios
__user
*
)
arg
,
real_tty
->
termios_locked
))
return
-
EFAULT
;
return
0
;
case
TIOCSLCKTRMIOS
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EPERM
;
if
(
user_termios_to_kernel_termios
(
real_tty
->
termios_locked
,
(
struct
termios
*
)
arg
))
if
(
user_termios_to_kernel_termios
(
real_tty
->
termios_locked
,
(
struct
termios
__user
*
)
arg
))
return
-
EFAULT
;
return
0
;
...
...
@@ -487,7 +488,7 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
if
(
tty
->
driver
->
type
!=
TTY_DRIVER_TYPE_PTY
||
tty
->
driver
->
subtype
!=
PTY_TYPE_MASTER
)
return
-
ENOTTY
;
if
(
get_user
(
pktmode
,
(
int
*
)
arg
))
if
(
get_user
(
pktmode
,
(
int
__user
*
)
arg
))
return
-
EFAULT
;
if
(
pktmode
)
{
if
(
!
tty
->
packet
)
{
...
...
@@ -499,9 +500,9 @@ int n_tty_ioctl(struct tty_struct * tty, struct file * file,
return
0
;
}
case
TIOCGSOFTCAR
:
return
put_user
(
C_CLOCAL
(
tty
)
?
1
:
0
,
(
int
*
)
arg
);
return
put_user
(
C_CLOCAL
(
tty
)
?
1
:
0
,
(
int
__user
*
)
arg
);
case
TIOCSSOFTCAR
:
if
(
get_user
(
arg
,
(
unsigned
int
*
)
arg
))
if
(
get_user
(
arg
,
(
unsigned
int
__user
*
)
arg
))
return
-
EFAULT
;
tty
->
termios
->
c_cflag
=
((
tty
->
termios
->
c_cflag
&
~
CLOCAL
)
|
...
...
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