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
f49b24c5
Commit
f49b24c5
authored
May 28, 2004
by
Alexander Viro
Committed by
Linus Torvalds
May 28, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: partial drivers/input __user annotation
parent
4e46f5c9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
24 deletions
+26
-24
drivers/input/evdev.c
drivers/input/evdev.c
+22
-20
drivers/input/mousedev.c
drivers/input/mousedev.c
+2
-2
drivers/input/serio/serport.c
drivers/input/serio/serport.c
+2
-2
No files found.
drivers/input/evdev.c
View file @
f49b24c5
...
@@ -147,7 +147,7 @@ static int evdev_open(struct inode * inode, struct file * file)
...
@@ -147,7 +147,7 @@ static int evdev_open(struct inode * inode, struct file * file)
return
0
;
return
0
;
}
}
static
ssize_t
evdev_write
(
struct
file
*
file
,
const
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
evdev_write
(
struct
file
*
file
,
const
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
evdev_list
*
list
=
file
->
private_data
;
struct
evdev_list
*
list
=
file
->
private_data
;
struct
input_event
event
;
struct
input_event
event
;
...
@@ -166,7 +166,7 @@ static ssize_t evdev_write(struct file * file, const char * buffer, size_t count
...
@@ -166,7 +166,7 @@ static ssize_t evdev_write(struct file * file, const char * buffer, size_t count
return
retval
;
return
retval
;
}
}
static
ssize_t
evdev_read
(
struct
file
*
file
,
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
evdev_read
(
struct
file
*
file
,
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
evdev_list
*
list
=
file
->
private_data
;
struct
evdev_list
*
list
=
file
->
private_data
;
int
retval
;
int
retval
;
...
@@ -209,6 +209,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -209,6 +209,8 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
struct
evdev
*
evdev
=
list
->
evdev
;
struct
evdev
*
evdev
=
list
->
evdev
;
struct
input_dev
*
dev
=
evdev
->
handle
.
dev
;
struct
input_dev
*
dev
=
evdev
->
handle
.
dev
;
struct
input_absinfo
abs
;
struct
input_absinfo
abs
;
void
__user
*
p
=
(
void
__user
*
)
arg
;
int
__user
*
ip
=
(
int
__user
*
)
arg
;
int
i
,
t
,
u
,
v
;
int
i
,
t
,
u
,
v
;
if
(
!
evdev
->
exist
)
return
-
ENODEV
;
if
(
!
evdev
->
exist
)
return
-
ENODEV
;
...
@@ -216,21 +218,21 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -216,21 +218,21 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
switch
(
cmd
)
{
switch
(
cmd
)
{
case
EVIOCGVERSION
:
case
EVIOCGVERSION
:
return
put_user
(
EV_VERSION
,
(
int
*
)
arg
);
return
put_user
(
EV_VERSION
,
ip
);
case
EVIOCGID
:
case
EVIOCGID
:
return
copy_to_user
(
(
void
*
)
arg
,
&
dev
->
id
,
sizeof
(
struct
input_id
))
?
-
EFAULT
:
0
;
return
copy_to_user
(
p
,
&
dev
->
id
,
sizeof
(
struct
input_id
))
?
-
EFAULT
:
0
;
case
EVIOCGKEYCODE
:
case
EVIOCGKEYCODE
:
if
(
get_user
(
t
,
((
int
*
)
arg
)
+
0
))
return
-
EFAULT
;
if
(
get_user
(
t
,
ip
))
return
-
EFAULT
;
if
(
t
<
0
||
t
>
dev
->
keycodemax
||
!
dev
->
keycodesize
)
return
-
EINVAL
;
if
(
t
<
0
||
t
>
dev
->
keycodemax
||
!
dev
->
keycodesize
)
return
-
EINVAL
;
if
(
put_user
(
INPUT_KEYCODE
(
dev
,
t
),
((
int
*
)
arg
)
+
1
))
return
-
EFAULT
;
if
(
put_user
(
INPUT_KEYCODE
(
dev
,
t
),
ip
+
1
))
return
-
EFAULT
;
return
0
;
return
0
;
case
EVIOCSKEYCODE
:
case
EVIOCSKEYCODE
:
if
(
get_user
(
t
,
((
int
*
)
arg
)
+
0
))
return
-
EFAULT
;
if
(
get_user
(
t
,
ip
))
return
-
EFAULT
;
if
(
t
<
0
||
t
>
dev
->
keycodemax
||
!
dev
->
keycodesize
)
return
-
EINVAL
;
if
(
t
<
0
||
t
>
dev
->
keycodemax
||
!
dev
->
keycodesize
)
return
-
EINVAL
;
if
(
get_user
(
v
,
((
int
*
)
arg
)
+
1
))
return
-
EFAULT
;
if
(
get_user
(
v
,
ip
+
1
))
return
-
EFAULT
;
u
=
SET_INPUT_KEYCODE
(
dev
,
t
,
v
);
u
=
SET_INPUT_KEYCODE
(
dev
,
t
,
v
);
clear_bit
(
u
,
dev
->
keybit
);
clear_bit
(
u
,
dev
->
keybit
);
set_bit
(
v
,
dev
->
keybit
);
set_bit
(
v
,
dev
->
keybit
);
...
@@ -244,10 +246,10 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -244,10 +246,10 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
struct
ff_effect
effect
;
struct
ff_effect
effect
;
int
err
;
int
err
;
if
(
copy_from_user
(
(
void
*
)(
&
effect
),
(
void
*
)
arg
,
sizeof
(
effect
)))
if
(
copy_from_user
(
&
effect
,
p
,
sizeof
(
effect
)))
return
-
EFAULT
;
return
-
EFAULT
;
err
=
dev
->
upload_effect
(
dev
,
&
effect
);
err
=
dev
->
upload_effect
(
dev
,
&
effect
);
if
(
put_user
(
effect
.
id
,
&
(((
struct
ff_effect
*
)
arg
)
->
id
)))
if
(
put_user
(
effect
.
id
,
&
(((
struct
ff_effect
__user
*
)
arg
)
->
id
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
err
;
return
err
;
}
}
...
@@ -260,7 +262,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -260,7 +262,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
else
return
-
ENOSYS
;
else
return
-
ENOSYS
;
case
EVIOCGEFFECTS
:
case
EVIOCGEFFECTS
:
if
(
put_user
(
dev
->
ff_effects_max
,
(
int
*
)
arg
))
if
(
put_user
(
dev
->
ff_effects_max
,
ip
))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -303,28 +305,28 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -303,28 +305,28 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
}
len
=
NBITS
(
len
)
*
sizeof
(
long
);
len
=
NBITS
(
len
)
*
sizeof
(
long
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
return
copy_to_user
(
(
char
*
)
arg
,
bits
,
len
)
?
-
EFAULT
:
len
;
return
copy_to_user
(
p
,
bits
,
len
)
?
-
EFAULT
:
len
;
}
}
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGKEY
(
0
)))
{
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGKEY
(
0
)))
{
int
len
;
int
len
;
len
=
NBITS
(
KEY_MAX
)
*
sizeof
(
long
);
len
=
NBITS
(
KEY_MAX
)
*
sizeof
(
long
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
return
copy_to_user
(
(
char
*
)
arg
,
dev
->
key
,
len
)
?
-
EFAULT
:
len
;
return
copy_to_user
(
p
,
dev
->
key
,
len
)
?
-
EFAULT
:
len
;
}
}
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGLED
(
0
)))
{
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGLED
(
0
)))
{
int
len
;
int
len
;
len
=
NBITS
(
LED_MAX
)
*
sizeof
(
long
);
len
=
NBITS
(
LED_MAX
)
*
sizeof
(
long
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
return
copy_to_user
(
(
char
*
)
arg
,
dev
->
led
,
len
)
?
-
EFAULT
:
len
;
return
copy_to_user
(
p
,
dev
->
led
,
len
)
?
-
EFAULT
:
len
;
}
}
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGSND
(
0
)))
{
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGSND
(
0
)))
{
int
len
;
int
len
;
len
=
NBITS
(
SND_MAX
)
*
sizeof
(
long
);
len
=
NBITS
(
SND_MAX
)
*
sizeof
(
long
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
return
copy_to_user
(
(
char
*
)
arg
,
dev
->
snd
,
len
)
?
-
EFAULT
:
len
;
return
copy_to_user
(
p
,
dev
->
snd
,
len
)
?
-
EFAULT
:
len
;
}
}
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGNAME
(
0
)))
{
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGNAME
(
0
)))
{
...
@@ -332,7 +334,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -332,7 +334,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if
(
!
dev
->
name
)
return
-
ENOENT
;
if
(
!
dev
->
name
)
return
-
ENOENT
;
len
=
strlen
(
dev
->
name
)
+
1
;
len
=
strlen
(
dev
->
name
)
+
1
;
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
return
copy_to_user
(
(
char
*
)
arg
,
dev
->
name
,
len
)
?
-
EFAULT
:
len
;
return
copy_to_user
(
p
,
dev
->
name
,
len
)
?
-
EFAULT
:
len
;
}
}
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGPHYS
(
0
)))
{
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGPHYS
(
0
)))
{
...
@@ -340,7 +342,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -340,7 +342,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if
(
!
dev
->
phys
)
return
-
ENOENT
;
if
(
!
dev
->
phys
)
return
-
ENOENT
;
len
=
strlen
(
dev
->
phys
)
+
1
;
len
=
strlen
(
dev
->
phys
)
+
1
;
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
return
copy_to_user
(
(
char
*
)
arg
,
dev
->
phys
,
len
)
?
-
EFAULT
:
len
;
return
copy_to_user
(
p
,
dev
->
phys
,
len
)
?
-
EFAULT
:
len
;
}
}
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGUNIQ
(
0
)))
{
if
(
_IOC_NR
(
cmd
)
==
_IOC_NR
(
EVIOCGUNIQ
(
0
)))
{
...
@@ -348,7 +350,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -348,7 +350,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if
(
!
dev
->
uniq
)
return
-
ENOENT
;
if
(
!
dev
->
uniq
)
return
-
ENOENT
;
len
=
strlen
(
dev
->
uniq
)
+
1
;
len
=
strlen
(
dev
->
uniq
)
+
1
;
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
if
(
len
>
_IOC_SIZE
(
cmd
))
len
=
_IOC_SIZE
(
cmd
);
return
copy_to_user
(
(
char
*
)
arg
,
dev
->
uniq
,
len
)
?
-
EFAULT
:
len
;
return
copy_to_user
(
p
,
dev
->
uniq
,
len
)
?
-
EFAULT
:
len
;
}
}
if
((
_IOC_NR
(
cmd
)
&
~
ABS_MAX
)
==
_IOC_NR
(
EVIOCGABS
(
0
)))
{
if
((
_IOC_NR
(
cmd
)
&
~
ABS_MAX
)
==
_IOC_NR
(
EVIOCGABS
(
0
)))
{
...
@@ -361,7 +363,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -361,7 +363,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
abs
.
fuzz
=
dev
->
absfuzz
[
t
];
abs
.
fuzz
=
dev
->
absfuzz
[
t
];
abs
.
flat
=
dev
->
absflat
[
t
];
abs
.
flat
=
dev
->
absflat
[
t
];
if
(
copy_to_user
(
(
void
*
)
arg
,
&
abs
,
sizeof
(
struct
input_absinfo
)))
if
(
copy_to_user
(
p
,
&
abs
,
sizeof
(
struct
input_absinfo
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -371,7 +373,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -371,7 +373,7 @@ static int evdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int
t
=
_IOC_NR
(
cmd
)
&
ABS_MAX
;
int
t
=
_IOC_NR
(
cmd
)
&
ABS_MAX
;
if
(
copy_from_user
(
&
abs
,
(
void
*
)
arg
,
sizeof
(
struct
input_absinfo
)))
if
(
copy_from_user
(
&
abs
,
p
,
sizeof
(
struct
input_absinfo
)))
return
-
EFAULT
;
return
-
EFAULT
;
dev
->
abs
[
t
]
=
abs
.
value
;
dev
->
abs
[
t
]
=
abs
.
value
;
...
...
drivers/input/mousedev.c
View file @
f49b24c5
...
@@ -339,7 +339,7 @@ static void mousedev_packet(struct mousedev_list *list, unsigned char off)
...
@@ -339,7 +339,7 @@ static void mousedev_packet(struct mousedev_list *list, unsigned char off)
}
}
static
ssize_t
mousedev_write
(
struct
file
*
file
,
const
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
mousedev_write
(
struct
file
*
file
,
const
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
mousedev_list
*
list
=
file
->
private_data
;
struct
mousedev_list
*
list
=
file
->
private_data
;
unsigned
char
c
;
unsigned
char
c
;
...
@@ -407,7 +407,7 @@ static ssize_t mousedev_write(struct file * file, const char * buffer, size_t co
...
@@ -407,7 +407,7 @@ static ssize_t mousedev_write(struct file * file, const char * buffer, size_t co
return
count
;
return
count
;
}
}
static
ssize_t
mousedev_read
(
struct
file
*
file
,
char
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
mousedev_read
(
struct
file
*
file
,
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
mousedev_list
*
list
=
file
->
private_data
;
struct
mousedev_list
*
list
=
file
->
private_data
;
int
retval
=
0
;
int
retval
=
0
;
...
...
drivers/input/serio/serport.c
View file @
f49b24c5
...
@@ -140,7 +140,7 @@ static int serport_ldisc_room(struct tty_struct *tty)
...
@@ -140,7 +140,7 @@ static int serport_ldisc_room(struct tty_struct *tty)
* returning 0 characters.
* returning 0 characters.
*/
*/
static
ssize_t
serport_ldisc_read
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
char
*
buf
,
size_t
nr
)
static
ssize_t
serport_ldisc_read
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
char
__user
*
buf
,
size_t
nr
)
{
{
struct
serport
*
serport
=
(
struct
serport
*
)
tty
->
disc_data
;
struct
serport
*
serport
=
(
struct
serport
*
)
tty
->
disc_data
;
char
name
[
64
];
char
name
[
64
];
...
@@ -167,7 +167,7 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi
...
@@ -167,7 +167,7 @@ static int serport_ldisc_ioctl(struct tty_struct * tty, struct file * file, unsi
struct
serport
*
serport
=
(
struct
serport
*
)
tty
->
disc_data
;
struct
serport
*
serport
=
(
struct
serport
*
)
tty
->
disc_data
;
if
(
cmd
==
SPIOCSTYPE
)
if
(
cmd
==
SPIOCSTYPE
)
return
get_user
(
serport
->
serio
.
type
,
(
unsigned
long
*
)
arg
);
return
get_user
(
serport
->
serio
.
type
,
(
unsigned
long
__user
*
)
arg
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
...
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