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
1d9086ac
Commit
1d9086ac
authored
Jun 23, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jun 23, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: trivial annotations in drivers/char/*
parent
a7834704
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
47 deletions
+47
-47
drivers/char/dtlk.c
drivers/char/dtlk.c
+7
-7
drivers/char/genrtc.c
drivers/char/genrtc.c
+8
-9
drivers/char/hpet.c
drivers/char/hpet.c
+3
-3
drivers/char/n_hdlc.c
drivers/char/n_hdlc.c
+6
-6
drivers/char/n_r3964.c
drivers/char/n_r3964.c
+7
-7
drivers/char/rocket.c
drivers/char/rocket.c
+13
-12
drivers/char/tipar.c
drivers/char/tipar.c
+3
-3
No files found.
drivers/char/dtlk.c
View file @
1d9086ac
...
...
@@ -85,9 +85,9 @@ static wait_queue_head_t dtlk_process_list;
static
struct
timer_list
dtlk_timer
;
/* prototypes for file_operations struct */
static
ssize_t
dtlk_read
(
struct
file
*
,
char
*
,
static
ssize_t
dtlk_read
(
struct
file
*
,
char
__user
*
,
size_t
nbytes
,
loff_t
*
ppos
);
static
ssize_t
dtlk_write
(
struct
file
*
,
const
char
*
,
static
ssize_t
dtlk_write
(
struct
file
*
,
const
char
__user
*
,
size_t
nbytes
,
loff_t
*
ppos
);
static
unsigned
int
dtlk_poll
(
struct
file
*
,
poll_table
*
);
static
int
dtlk_open
(
struct
inode
*
,
struct
file
*
);
...
...
@@ -121,7 +121,7 @@ static char dtlk_write_tts(char);
*/
static
void
dtlk_timer_tick
(
unsigned
long
data
);
static
ssize_t
dtlk_read
(
struct
file
*
file
,
char
*
buf
,
static
ssize_t
dtlk_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
unsigned
int
minor
=
iminor
(
file
->
f_dentry
->
d_inode
);
...
...
@@ -158,7 +158,7 @@ static ssize_t dtlk_read(struct file *file, char *buf,
return
-
EAGAIN
;
}
static
ssize_t
dtlk_write
(
struct
file
*
file
,
const
char
*
buf
,
static
ssize_t
dtlk_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
int
i
=
0
,
retries
=
0
,
ch
;
...
...
@@ -277,6 +277,7 @@ static int dtlk_ioctl(struct inode *inode,
unsigned
int
cmd
,
unsigned
long
arg
)
{
char
__user
*
argp
=
(
char
__user
*
)
arg
;
struct
dtlk_settings
*
sp
;
char
portval
;
TRACE_TEXT
(
" dtlk_ioctl"
);
...
...
@@ -285,14 +286,13 @@ static int dtlk_ioctl(struct inode *inode,
case
DTLK_INTERROGATE
:
sp
=
dtlk_interrogate
();
if
(
copy_to_user
((
char
*
)
arg
,
(
char
*
)
sp
,
sizeof
(
struct
dtlk_settings
)))
if
(
copy_to_user
(
argp
,
sp
,
sizeof
(
struct
dtlk_settings
)))
return
-
EINVAL
;
return
0
;
case
DTLK_STATUS
:
portval
=
inb_p
(
dtlk_port_tts
);
return
put_user
(
portval
,
(
char
*
)
arg
);
return
put_user
(
portval
,
argp
);
default:
return
-
EINVAL
;
...
...
drivers/char/genrtc.c
View file @
1d9086ac
...
...
@@ -171,7 +171,7 @@ static void gen_rtc_interrupt(unsigned long arg)
/*
* Now all the various file operations that we export.
*/
static
ssize_t
gen_rtc_read
(
struct
file
*
file
,
char
*
buf
,
static
ssize_t
gen_rtc_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
DECLARE_WAITQUEUE
(
wait
,
current
);
...
...
@@ -200,10 +200,10 @@ static ssize_t gen_rtc_read(struct file *file, char *buf,
/* first test allows optimizer to nuke this case for 32-bit machines */
if
(
sizeof
(
int
)
!=
sizeof
(
long
)
&&
count
==
sizeof
(
unsigned
int
))
{
unsigned
int
uidata
=
data
;
retval
=
put_user
(
uidata
,
(
unsigned
long
*
)
buf
);
retval
=
put_user
(
uidata
,
(
unsigned
long
__user
*
)
buf
);
}
else
{
retval
=
put_user
(
data
,
(
unsigned
long
*
)
buf
);
retval
=
put_user
(
data
,
(
unsigned
long
__user
*
)
buf
);
}
if
(
!
retval
)
retval
=
sizeof
(
unsigned
long
);
...
...
@@ -278,6 +278,7 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
{
struct
rtc_time
wtime
;
struct
rtc_pll_info
pll
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
switch
(
cmd
)
{
...
...
@@ -285,13 +286,12 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
if
(
get_rtc_pll
(
&
pll
))
return
-
EINVAL
;
else
return
copy_to_user
(
(
void
*
)
arg
,
&
pll
,
sizeof
pll
)
?
-
EFAULT
:
0
;
return
copy_to_user
(
argp
,
&
pll
,
sizeof
pll
)
?
-
EFAULT
:
0
;
case
RTC_PLL_SET
:
if
(
!
capable
(
CAP_SYS_TIME
))
return
-
EACCES
;
if
(
copy_from_user
(
&
pll
,
(
struct
rtc_pll_info
*
)
arg
,
sizeof
(
pll
)))
if
(
copy_from_user
(
&
pll
,
argp
,
sizeof
(
pll
)))
return
-
EFAULT
;
return
set_rtc_pll
(
&
pll
);
...
...
@@ -307,7 +307,7 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
memset
(
&
wtime
,
0
,
sizeof
(
wtime
));
get_rtc_time
(
&
wtime
);
return
copy_to_user
(
(
void
*
)
arg
,
&
wtime
,
sizeof
(
wtime
))
?
-
EFAULT
:
0
;
return
copy_to_user
(
argp
,
&
wtime
,
sizeof
(
wtime
))
?
-
EFAULT
:
0
;
case
RTC_SET_TIME
:
/* Set the RTC */
{
...
...
@@ -317,8 +317,7 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
if
(
!
capable
(
CAP_SYS_TIME
))
return
-
EACCES
;
if
(
copy_from_user
(
&
wtime
,
(
struct
rtc_time
*
)
arg
,
sizeof
(
wtime
)))
if
(
copy_from_user
(
&
wtime
,
argp
,
sizeof
(
wtime
)))
return
-
EFAULT
;
year
=
wtime
.
tm_year
+
1900
;
...
...
drivers/char/hpet.c
View file @
1d9086ac
...
...
@@ -174,7 +174,7 @@ static int hpet_open(struct inode *inode, struct file *file)
}
static
ssize_t
hpet_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
hpet_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
DECLARE_WAITQUEUE
(
wait
,
current
);
unsigned
long
data
;
...
...
@@ -212,7 +212,7 @@ hpet_read(struct file *file, char *buf, size_t count, loff_t * ppos)
}
while
(
1
);
retval
=
put_user
(
data
,
(
unsigned
long
*
)
buf
);
retval
=
put_user
(
data
,
(
unsigned
long
__user
*
)
buf
);
if
(
!
retval
)
retval
=
sizeof
(
unsigned
long
);
out:
...
...
@@ -477,7 +477,7 @@ hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
readq
(
&
timer
->
hpet_config
)
&
Tn_PER_INT_CAP_MASK
;
info
.
hi_hpet
=
devp
->
hd_hpets
->
hp_which
;
info
.
hi_timer
=
devp
-
devp
->
hd_hpets
->
hp_dev
;
if
(
copy_to_user
((
void
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
((
void
__user
*
)
arg
,
&
info
,
sizeof
(
info
)))
err
=
-
EFAULT
;
break
;
}
...
...
drivers/char/n_hdlc.c
View file @
1d9086ac
...
...
@@ -182,9 +182,9 @@ static ssize_t maxframe = 4096;
/* TTY callbacks */
static
ssize_t
n_hdlc_tty_read
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
__u8
*
buf
,
size_t
nr
);
__u8
__user
*
buf
,
size_t
nr
);
static
ssize_t
n_hdlc_tty_write
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
const
__u8
*
buf
,
size_t
nr
);
const
__u8
__user
*
buf
,
size_t
nr
);
static
int
n_hdlc_tty_ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
static
unsigned
int
n_hdlc_tty_poll
(
struct
tty_struct
*
tty
,
struct
file
*
filp
,
...
...
@@ -572,7 +572,7 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
* Returns the number of bytes returned or error code.
*/
static
ssize_t
n_hdlc_tty_read
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
__u8
*
buf
,
size_t
nr
)
__u8
__user
*
buf
,
size_t
nr
)
{
struct
n_hdlc
*
n_hdlc
=
tty2n_hdlc
(
tty
);
int
error
;
...
...
@@ -649,7 +649,7 @@ static ssize_t n_hdlc_tty_read(struct tty_struct *tty, struct file *file,
* Returns the number of bytes written (or error code).
*/
static
ssize_t
n_hdlc_tty_write
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
const
__u8
*
data
,
size_t
count
)
const
__u8
__user
*
data
,
size_t
count
)
{
struct
n_hdlc
*
n_hdlc
=
tty2n_hdlc
(
tty
);
int
error
=
0
;
...
...
@@ -755,7 +755,7 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
else
count
=
0
;
spin_unlock_irqrestore
(
&
n_hdlc
->
rx_buf_list
.
spinlock
,
flags
);
error
=
put_user
(
count
,
(
int
*
)
arg
);
error
=
put_user
(
count
,
(
int
__user
*
)
arg
);
break
;
case
TIOCOUTQ
:
...
...
@@ -767,7 +767,7 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
if
(
n_hdlc
->
tx_buf_list
.
head
)
count
+=
n_hdlc
->
tx_buf_list
.
head
->
count
;
spin_unlock_irqrestore
(
&
n_hdlc
->
tx_buf_list
.
spinlock
,
flags
);
error
=
put_user
(
count
,
(
int
*
)
arg
);
error
=
put_user
(
count
,
(
int
__user
*
)
arg
);
break
;
default:
...
...
drivers/char/n_r3964.c
View file @
1d9086ac
...
...
@@ -126,7 +126,7 @@ static void receive_char(struct r3964_info *pInfo, const unsigned char c);
static
void
receive_error
(
struct
r3964_info
*
pInfo
,
const
char
flag
);
static
void
on_timeout
(
unsigned
long
priv
);
static
int
enable_signals
(
struct
r3964_info
*
pInfo
,
pid_t
pid
,
int
arg
);
static
int
read_telegram
(
struct
r3964_info
*
pInfo
,
pid_t
pid
,
unsigned
char
*
buf
);
static
int
read_telegram
(
struct
r3964_info
*
pInfo
,
pid_t
pid
,
unsigned
char
__user
*
buf
);
static
void
add_msg
(
struct
r3964_client_info
*
pClient
,
int
msg_id
,
int
arg
,
int
error_code
,
struct
r3964_block_header
*
pBlock
);
static
struct
r3964_message
*
remove_msg
(
struct
r3964_info
*
pInfo
,
...
...
@@ -137,9 +137,9 @@ static void remove_client_block(struct r3964_info *pInfo,
static
int
r3964_open
(
struct
tty_struct
*
tty
);
static
void
r3964_close
(
struct
tty_struct
*
tty
);
static
ssize_t
r3964_read
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
char
*
buf
,
size_t
nr
);
unsigned
char
__user
*
buf
,
size_t
nr
);
static
ssize_t
r3964_write
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
const
unsigned
char
*
buf
,
size_t
nr
);
const
unsigned
char
__user
*
buf
,
size_t
nr
);
static
int
r3964_ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
static
void
r3964_set_termios
(
struct
tty_struct
*
tty
,
struct
termios
*
old
);
...
...
@@ -910,7 +910,7 @@ static int enable_signals(struct r3964_info *pInfo, pid_t pid, int arg)
return
0
;
}
static
int
read_telegram
(
struct
r3964_info
*
pInfo
,
pid_t
pid
,
unsigned
char
*
buf
)
static
int
read_telegram
(
struct
r3964_info
*
pInfo
,
pid_t
pid
,
unsigned
char
__user
*
buf
)
{
struct
r3964_client_info
*
pClient
;
struct
r3964_block_header
*
block
;
...
...
@@ -1185,7 +1185,7 @@ static void r3964_close(struct tty_struct *tty)
}
static
ssize_t
r3964_read
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
char
*
buf
,
size_t
nr
)
unsigned
char
__user
*
buf
,
size_t
nr
)
{
struct
r3964_info
*
pInfo
=
(
struct
r3964_info
*
)
tty
->
disc_data
;
struct
r3964_client_info
*
pClient
;
...
...
@@ -1246,7 +1246,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
}
static
ssize_t
r3964_write
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
const
unsigned
char
*
data
,
size_t
count
)
const
unsigned
char
__user
*
data
,
size_t
count
)
{
struct
r3964_info
*
pInfo
=
(
struct
r3964_info
*
)
tty
->
disc_data
;
struct
r3964_block_header
*
pHeader
;
...
...
@@ -1348,7 +1348,7 @@ static int r3964_ioctl(struct tty_struct * tty, struct file * file,
pInfo
->
flags
&=
~
R3964_BCC
;
return
0
;
case
R3964_READ_TELEGRAM
:
return
read_telegram
(
pInfo
,
current
->
pid
,
(
unsigned
char
*
)
arg
);
return
read_telegram
(
pInfo
,
current
->
pid
,
(
unsigned
char
__user
*
)
arg
);
default:
return
-
ENOIOCTLCMD
;
}
...
...
drivers/char/rocket.c
View file @
1d9086ac
...
...
@@ -1258,7 +1258,7 @@ static int rp_tiocmset(struct tty_struct *tty, struct file *file,
return
0
;
}
static
int
get_config
(
struct
r_port
*
info
,
struct
rocket_config
*
retinfo
)
static
int
get_config
(
struct
r_port
*
info
,
struct
rocket_config
__user
*
retinfo
)
{
struct
rocket_config
tmp
;
...
...
@@ -1276,7 +1276,7 @@ static int get_config(struct r_port *info, struct rocket_config *retinfo)
return
0
;
}
static
int
set_config
(
struct
r_port
*
info
,
struct
rocket_config
*
new_info
)
static
int
set_config
(
struct
r_port
*
info
,
struct
rocket_config
__user
*
new_info
)
{
struct
rocket_config
new_serial
;
...
...
@@ -1319,7 +1319,7 @@ static int set_config(struct r_port *info, struct rocket_config *new_info)
* to user space. See setrocket.c where the info is used to create
* the /dev/ttyRx ports.
*/
static
int
get_ports
(
struct
r_port
*
info
,
struct
rocket_ports
*
retports
)
static
int
get_ports
(
struct
r_port
*
info
,
struct
rocket_ports
__user
*
retports
)
{
struct
rocket_ports
tmp
;
int
board
;
...
...
@@ -1341,11 +1341,11 @@ static int get_ports(struct r_port *info, struct rocket_ports *retports)
return
0
;
}
static
int
reset_rm2
(
struct
r_port
*
info
,
unsigned
long
arg
)
static
int
reset_rm2
(
struct
r_port
*
info
,
void
__user
*
arg
)
{
int
reset
;
if
(
copy_from_user
(
&
reset
,
(
void
*
)
arg
,
sizeof
(
int
)))
if
(
copy_from_user
(
&
reset
,
arg
,
sizeof
(
int
)))
return
-
EFAULT
;
if
(
reset
)
reset
=
1
;
...
...
@@ -1362,7 +1362,7 @@ static int reset_rm2(struct r_port *info, unsigned long arg)
return
0
;
}
static
int
get_version
(
struct
r_port
*
info
,
struct
rocket_version
*
retvers
)
static
int
get_version
(
struct
r_port
*
info
,
struct
rocket_version
__user
*
retvers
)
{
if
(
copy_to_user
(
retvers
,
&
driver_version
,
sizeof
(
*
retvers
)))
return
-
EFAULT
;
...
...
@@ -1374,25 +1374,26 @@ static int rp_ioctl(struct tty_struct *tty, struct file *file,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
r_port
*
info
=
(
struct
r_port
*
)
tty
->
driver_data
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
if
(
cmd
!=
RCKP_GET_PORTS
&&
rocket_paranoia_check
(
info
,
"rp_ioctl"
))
return
-
ENXIO
;
switch
(
cmd
)
{
case
RCKP_GET_STRUCT
:
if
(
copy_to_user
(
(
void
*
)
arg
,
info
,
sizeof
(
struct
r_port
)))
if
(
copy_to_user
(
argp
,
info
,
sizeof
(
struct
r_port
)))
return
-
EFAULT
;
return
0
;
case
RCKP_GET_CONFIG
:
return
get_config
(
info
,
(
struct
rocket_config
*
)
arg
);
return
get_config
(
info
,
argp
);
case
RCKP_SET_CONFIG
:
return
set_config
(
info
,
(
struct
rocket_config
*
)
arg
);
return
set_config
(
info
,
argp
);
case
RCKP_GET_PORTS
:
return
get_ports
(
info
,
(
struct
rocket_ports
*
)
arg
);
return
get_ports
(
info
,
argp
);
case
RCKP_RESET_RM2
:
return
reset_rm2
(
info
,
arg
);
return
reset_rm2
(
info
,
arg
p
);
case
RCKP_GET_VERSION
:
return
get_version
(
info
,
(
struct
rocket_version
*
)
arg
);
return
get_version
(
info
,
argp
);
default:
return
-
ENOIOCTLCMD
;
}
...
...
drivers/char/tipar.c
View file @
1d9086ac
...
...
@@ -279,7 +279,7 @@ tipar_close(struct inode *inode, struct file *file)
}
static
ssize_t
tipar_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
tipar_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
unsigned
int
minor
=
iminor
(
file
->
f_dentry
->
d_inode
)
-
TIPAR_MINOR
;
ssize_t
n
;
...
...
@@ -306,7 +306,7 @@ tipar_write(struct file *file, const char *buf, size_t count, loff_t * ppos)
}
static
ssize_t
tipar_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
tipar_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
int
b
=
0
;
unsigned
int
minor
=
iminor
(
file
->
f_dentry
->
d_inode
)
-
TIPAR_MINOR
;
...
...
@@ -328,7 +328,7 @@ tipar_read(struct file *file, char *buf, size_t count, loff_t * ppos)
retval
=
-
ETIMEDOUT
;
goto
out
;
}
else
{
if
(
put_user
(
b
,
((
unsigned
char
*
)
buf
)
+
n
))
{
if
(
put_user
(
b
,
buf
+
n
))
{
retval
=
-
EFAULT
;
break
;
}
else
...
...
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