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
0bc20408
Commit
0bc20408
authored
Jul 12, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jul 12, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: drivers/sbus annotation
parent
61e7f08f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
85 additions
and
83 deletions
+85
-83
drivers/sbus/char/bpp.c
drivers/sbus/char/bpp.c
+6
-6
drivers/sbus/char/cpwatchdog.c
drivers/sbus/char/cpwatchdog.c
+10
-11
drivers/sbus/char/display7seg.c
drivers/sbus/char/display7seg.c
+2
-2
drivers/sbus/char/envctrl.c
drivers/sbus/char/envctrl.c
+13
-13
drivers/sbus/char/flash.c
drivers/sbus/char/flash.c
+1
-1
drivers/sbus/char/openprom.c
drivers/sbus/char/openprom.c
+26
-24
drivers/sbus/char/riowatchdog.c
drivers/sbus/char/riowatchdog.c
+7
-6
drivers/sbus/char/rtc.c
drivers/sbus/char/rtc.c
+3
-2
drivers/sbus/char/vfc_dev.c
drivers/sbus/char/vfc_dev.c
+16
-17
include/asm-sparc/vfc_ioctls.h
include/asm-sparc/vfc_ioctls.h
+1
-1
No files found.
drivers/sbus/char/bpp.c
View file @
0bc20408
...
@@ -482,7 +482,7 @@ static int bpp_release(struct inode *inode, struct file *f)
...
@@ -482,7 +482,7 @@ static int bpp_release(struct inode *inode, struct file *f)
return
0
;
return
0
;
}
}
static
long
read_nibble
(
unsigned
minor
,
char
*
c
,
unsigned
long
cnt
)
static
long
read_nibble
(
unsigned
minor
,
char
__user
*
c
,
unsigned
long
cnt
)
{
{
unsigned
long
remaining
=
cnt
;
unsigned
long
remaining
=
cnt
;
long
rc
;
long
rc
;
...
@@ -535,7 +535,7 @@ static long read_nibble(unsigned minor, char *c, unsigned long cnt)
...
@@ -535,7 +535,7 @@ static long read_nibble(unsigned minor, char *c, unsigned long cnt)
return
cnt
-
remaining
;
return
cnt
-
remaining
;
}
}
static
long
read_ecp
(
unsigned
minor
,
char
*
c
,
unsigned
long
cnt
)
static
long
read_ecp
(
unsigned
minor
,
char
__user
*
c
,
unsigned
long
cnt
)
{
{
unsigned
long
remaining
;
unsigned
long
remaining
;
long
rc
;
long
rc
;
...
@@ -630,7 +630,7 @@ static long read_ecp(unsigned minor, char *c, unsigned long cnt)
...
@@ -630,7 +630,7 @@ static long read_ecp(unsigned minor, char *c, unsigned long cnt)
return
cnt
-
remaining
;
return
cnt
-
remaining
;
}
}
static
ssize_t
bpp_read
(
struct
file
*
f
,
char
*
c
,
size_t
cnt
,
loff_t
*
ppos
)
static
ssize_t
bpp_read
(
struct
file
*
f
,
char
__user
*
c
,
size_t
cnt
,
loff_t
*
ppos
)
{
{
long
rc
;
long
rc
;
unsigned
minor
=
iminor
(
f
->
f_dentry
->
d_inode
);
unsigned
minor
=
iminor
(
f
->
f_dentry
->
d_inode
);
...
@@ -692,7 +692,7 @@ static ssize_t bpp_read(struct file *f, char *c, size_t cnt, loff_t * ppos)
...
@@ -692,7 +692,7 @@ static ssize_t bpp_read(struct file *f, char *c, size_t cnt, loff_t * ppos)
* Compatibility mode handshaking is a matter of writing data,
* Compatibility mode handshaking is a matter of writing data,
* strobing it, and waiting for the printer to stop being busy.
* strobing it, and waiting for the printer to stop being busy.
*/
*/
static
long
write_compat
(
unsigned
minor
,
const
char
*
c
,
unsigned
long
cnt
)
static
long
write_compat
(
unsigned
minor
,
const
char
__user
*
c
,
unsigned
long
cnt
)
{
{
long
rc
;
long
rc
;
unsigned
short
pins
=
get_pins
(
minor
);
unsigned
short
pins
=
get_pins
(
minor
);
...
@@ -730,7 +730,7 @@ static long write_compat(unsigned minor, const char *c, unsigned long cnt)
...
@@ -730,7 +730,7 @@ static long write_compat(unsigned minor, const char *c, unsigned long cnt)
* Write data using ECP mode. Watch out that the port may be set up
* Write data using ECP mode. Watch out that the port may be set up
* for reading. If so, turn the port around.
* for reading. If so, turn the port around.
*/
*/
static
long
write_ecp
(
unsigned
minor
,
const
char
*
c
,
unsigned
long
cnt
)
static
long
write_ecp
(
unsigned
minor
,
const
char
__user
*
c
,
unsigned
long
cnt
)
{
{
unsigned
short
pins
=
get_pins
(
minor
);
unsigned
short
pins
=
get_pins
(
minor
);
unsigned
long
remaining
=
cnt
;
unsigned
long
remaining
=
cnt
;
...
@@ -783,7 +783,7 @@ static long write_ecp(unsigned minor, const char *c, unsigned long cnt)
...
@@ -783,7 +783,7 @@ static long write_ecp(unsigned minor, const char *c, unsigned long cnt)
* that. Otherwise, terminate and do my writing in compat mode. This
* that. Otherwise, terminate and do my writing in compat mode. This
* is the safest course as any device can handle it.
* is the safest course as any device can handle it.
*/
*/
static
ssize_t
bpp_write
(
struct
file
*
f
,
const
char
*
c
,
size_t
cnt
,
loff_t
*
ppos
)
static
ssize_t
bpp_write
(
struct
file
*
f
,
const
char
__user
*
c
,
size_t
cnt
,
loff_t
*
ppos
)
{
{
long
errno
=
0
;
long
errno
=
0
;
unsigned
minor
=
iminor
(
f
->
f_dentry
->
d_inode
);
unsigned
minor
=
iminor
(
f
->
f_dentry
->
d_inode
);
...
...
drivers/sbus/char/cpwatchdog.c
View file @
0bc20408
...
@@ -337,6 +337,7 @@ static int wd_ioctl(struct inode *inode, struct file *file,
...
@@ -337,6 +337,7 @@ static int wd_ioctl(struct inode *inode, struct file *file,
{
{
int
setopt
=
0
;
int
setopt
=
0
;
struct
wd_timer
*
pTimer
=
(
struct
wd_timer
*
)
file
->
private_data
;
struct
wd_timer
*
pTimer
=
(
struct
wd_timer
*
)
file
->
private_data
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
struct
watchdog_info
info
=
{
struct
watchdog_info
info
=
{
0
,
0
,
0
,
0
,
...
@@ -351,22 +352,20 @@ static int wd_ioctl(struct inode *inode, struct file *file,
...
@@ -351,22 +352,20 @@ static int wd_ioctl(struct inode *inode, struct file *file,
{
{
/* Generic Linux IOCTLs */
/* Generic Linux IOCTLs */
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
((
struct
watchdog_info
*
)
arg
,
if
(
copy_to_user
(
argp
,
&
info
,
sizeof
(
struct
watchdog_info
)))
{
(
struct
watchdog_info
*
)
&
info
,
sizeof
(
struct
watchdog_info
)))
{
return
(
-
EFAULT
);
return
(
-
EFAULT
);
}
}
break
;
break
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
if
(
put_user
(
0
,
(
int
*
)
arg
))
if
(
put_user
(
0
,
(
int
__user
*
)
argp
))
return
-
EFAULT
;
return
-
EFAULT
;
break
;
break
;
case
WDIOC_KEEPALIVE
:
case
WDIOC_KEEPALIVE
:
wd_pingtimer
(
pTimer
);
wd_pingtimer
(
pTimer
);
break
;
break
;
case
WDIOC_SETOPTIONS
:
case
WDIOC_SETOPTIONS
:
if
(
copy_from_user
(
&
setopt
,
(
void
*
)
arg
,
sizeof
(
unsigned
int
)))
{
if
(
copy_from_user
(
&
setopt
,
argp
,
sizeof
(
unsigned
int
)))
{
return
-
EFAULT
;
return
-
EFAULT
;
}
}
if
(
setopt
&
WDIOS_DISABLECARD
)
{
if
(
setopt
&
WDIOS_DISABLECARD
)
{
...
@@ -388,7 +387,7 @@ static int wd_ioctl(struct inode *inode, struct file *file,
...
@@ -388,7 +387,7 @@ static int wd_ioctl(struct inode *inode, struct file *file,
/* Solaris-compatible IOCTLs */
/* Solaris-compatible IOCTLs */
case
WIOCGSTAT
:
case
WIOCGSTAT
:
setopt
=
wd_getstatus
(
pTimer
);
setopt
=
wd_getstatus
(
pTimer
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
setopt
,
sizeof
(
unsigned
int
)))
{
if
(
copy_to_user
(
argp
,
&
setopt
,
sizeof
(
unsigned
int
)))
{
return
(
-
EFAULT
);
return
(
-
EFAULT
);
}
}
break
;
break
;
...
@@ -409,8 +408,8 @@ static int wd_ioctl(struct inode *inode, struct file *file,
...
@@ -409,8 +408,8 @@ static int wd_ioctl(struct inode *inode, struct file *file,
return
(
0
);
return
(
0
);
}
}
static
ssize_t
wd_write
(
struct
file
*
file
,
static
ssize_t
wd_write
(
struct
file
*
file
,
const
char
*
buf
,
const
char
__user
*
buf
,
size_t
count
,
size_t
count
,
loff_t
*
ppos
)
loff_t
*
ppos
)
{
{
...
@@ -430,7 +429,7 @@ static ssize_t wd_write( struct file *file,
...
@@ -430,7 +429,7 @@ static ssize_t wd_write( struct file *file,
return
0
;
return
0
;
}
}
static
ssize_t
wd_read
(
struct
file
*
file
,
char
*
buffer
,
static
ssize_t
wd_read
(
struct
file
*
file
,
char
__user
*
buffer
,
size_t
count
,
loff_t
*
ppos
)
size_t
count
,
loff_t
*
ppos
)
{
{
#ifdef WD_DEBUG
#ifdef WD_DEBUG
...
...
drivers/sbus/char/display7seg.c
View file @
0bc20408
...
@@ -128,7 +128,7 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
...
@@ -128,7 +128,7 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
/* assign device register values
/* assign device register values
* we mask-out D7S_FLIP if in sol_compat mode
* we mask-out D7S_FLIP if in sol_compat mode
*/
*/
if
(
get_user
(
ireg
,
(
int
*
)
arg
))
if
(
get_user
(
ireg
,
(
int
__user
*
)
arg
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
0
!=
sol_compat
)
{
if
(
0
!=
sol_compat
)
{
(
regs
&
D7S_FLIP
)
?
(
regs
&
D7S_FLIP
)
?
...
@@ -144,7 +144,7 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
...
@@ -144,7 +144,7 @@ static int d7s_ioctl(struct inode *inode, struct file *f,
* This driver will not misinform you about the state
* This driver will not misinform you about the state
* of your hardware while in sol_compat mode
* of your hardware while in sol_compat mode
*/
*/
if
(
put_user
(
regs
,
(
int
*
)
arg
))
if
(
put_user
(
regs
,
(
int
__user
*
)
arg
))
return
-
EFAULT
;
return
-
EFAULT
;
break
;
break
;
...
...
drivers/sbus/char/envctrl.c
View file @
0bc20408
...
@@ -556,7 +556,7 @@ static unsigned char envctrl_i2c_voltage_status(struct i2c_child_t *pchild,
...
@@ -556,7 +556,7 @@ static unsigned char envctrl_i2c_voltage_status(struct i2c_child_t *pchild,
* Return: Number of read bytes. 0 for error.
* Return: Number of read bytes. 0 for error.
*/
*/
static
ssize_t
static
ssize_t
envctrl_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
envctrl_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
i2c_child_t
*
pchild
;
struct
i2c_child_t
*
pchild
;
unsigned
char
data
[
10
];
unsigned
char
data
[
10
];
...
@@ -574,7 +574,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -574,7 +574,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
data
[
0
]
=
(
unsigned
char
)(
warning_temperature
);
data
[
0
]
=
(
unsigned
char
)(
warning_temperature
);
ret
=
1
;
ret
=
1
;
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -584,7 +584,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -584,7 +584,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
data
[
0
]
=
(
unsigned
char
)(
shutdown_temperature
);
data
[
0
]
=
(
unsigned
char
)(
shutdown_temperature
);
ret
=
1
;
ret
=
1
;
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -592,7 +592,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -592,7 +592,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if
(
!
(
pchild
=
envctrl_get_i2c_child
(
ENVCTRL_MTHRBDTEMP_MON
)))
if
(
!
(
pchild
=
envctrl_get_i2c_child
(
ENVCTRL_MTHRBDTEMP_MON
)))
return
0
;
return
0
;
ret
=
envctrl_read_noncpu_info
(
pchild
,
ENVCTRL_MTHRBDTEMP_MON
,
data
);
ret
=
envctrl_read_noncpu_info
(
pchild
,
ENVCTRL_MTHRBDTEMP_MON
,
data
);
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -602,7 +602,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -602,7 +602,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
ret
=
envctrl_read_cpu_info
(
read_cpu
,
pchild
,
ENVCTRL_CPUTEMP_MON
,
data
);
ret
=
envctrl_read_cpu_info
(
read_cpu
,
pchild
,
ENVCTRL_CPUTEMP_MON
,
data
);
/* Reset cpu to the default cpu0. */
/* Reset cpu to the default cpu0. */
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -612,7 +612,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -612,7 +612,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
ret
=
envctrl_read_cpu_info
(
read_cpu
,
pchild
,
ENVCTRL_CPUVOLTAGE_MON
,
data
);
ret
=
envctrl_read_cpu_info
(
read_cpu
,
pchild
,
ENVCTRL_CPUVOLTAGE_MON
,
data
);
/* Reset cpu to the default cpu0. */
/* Reset cpu to the default cpu0. */
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -620,7 +620,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -620,7 +620,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if
(
!
(
pchild
=
envctrl_get_i2c_child
(
ENVCTRL_SCSITEMP_MON
)))
if
(
!
(
pchild
=
envctrl_get_i2c_child
(
ENVCTRL_SCSITEMP_MON
)))
return
0
;
return
0
;
ret
=
envctrl_read_noncpu_info
(
pchild
,
ENVCTRL_SCSITEMP_MON
,
data
);
ret
=
envctrl_read_noncpu_info
(
pchild
,
ENVCTRL_SCSITEMP_MON
,
data
);
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -628,7 +628,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -628,7 +628,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if
(
!
(
pchild
=
envctrl_get_i2c_child
(
ENVCTRL_ETHERTEMP_MON
)))
if
(
!
(
pchild
=
envctrl_get_i2c_child
(
ENVCTRL_ETHERTEMP_MON
)))
return
0
;
return
0
;
ret
=
envctrl_read_noncpu_info
(
pchild
,
ENVCTRL_ETHERTEMP_MON
,
data
);
ret
=
envctrl_read_noncpu_info
(
pchild
,
ENVCTRL_ETHERTEMP_MON
,
data
);
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -637,7 +637,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -637,7 +637,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
return
0
;
return
0
;
data
[
0
]
=
envctrl_i2c_read_8574
(
pchild
->
addr
);
data
[
0
]
=
envctrl_i2c_read_8574
(
pchild
->
addr
);
ret
=
envctrl_i2c_fan_status
(
pchild
,
data
[
0
],
data
);
ret
=
envctrl_i2c_fan_status
(
pchild
,
data
[
0
],
data
);
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -646,7 +646,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -646,7 +646,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
return
0
;
return
0
;
data
[
0
]
=
envctrl_i2c_read_8574
(
pchild
->
addr
);
data
[
0
]
=
envctrl_i2c_read_8574
(
pchild
->
addr
);
ret
=
envctrl_i2c_globaladdr
(
pchild
,
data
[
0
],
data
);
ret
=
envctrl_i2c_globaladdr
(
pchild
,
data
[
0
],
data
);
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -657,7 +657,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
...
@@ -657,7 +657,7 @@ envctrl_read(struct file *file, char *buf, size_t count, loff_t *ppos)
return
0
;
return
0
;
data
[
0
]
=
envctrl_i2c_read_8574
(
pchild
->
addr
);
data
[
0
]
=
envctrl_i2c_read_8574
(
pchild
->
addr
);
ret
=
envctrl_i2c_voltage_status
(
pchild
,
data
[
0
],
data
);
ret
=
envctrl_i2c_voltage_status
(
pchild
,
data
[
0
],
data
);
if
(
copy_to_user
(
(
unsigned
char
*
)
buf
,
data
,
ret
))
if
(
copy_to_user
(
buf
,
data
,
ret
))
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
...
@@ -676,7 +676,7 @@ static int
...
@@ -676,7 +676,7 @@ static int
envctrl_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
envctrl_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
unsigned
int
cmd
,
unsigned
long
arg
)
{
{
char
*
infobuf
;
char
__user
*
infobuf
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
ENVCTRL_RD_WARNING_TEMPERATURE
:
case
ENVCTRL_RD_WARNING_TEMPERATURE
:
...
@@ -695,7 +695,7 @@ envctrl_ioctl(struct inode *inode, struct file *file,
...
@@ -695,7 +695,7 @@ envctrl_ioctl(struct inode *inode, struct file *file,
/* Check to see if application passes in any cpu number,
/* Check to see if application passes in any cpu number,
* the default is cpu0.
* the default is cpu0.
*/
*/
infobuf
=
(
char
*
)
arg
;
infobuf
=
(
char
__user
*
)
arg
;
if
(
infobuf
==
NULL
)
{
if
(
infobuf
==
NULL
)
{
read_cpu
=
0
;
read_cpu
=
0
;
}
else
{
}
else
{
...
...
drivers/sbus/char/flash.c
View file @
0bc20408
...
@@ -105,7 +105,7 @@ flash_llseek(struct file *file, long long offset, int origin)
...
@@ -105,7 +105,7 @@ flash_llseek(struct file *file, long long offset, int origin)
}
}
static
ssize_t
static
ssize_t
flash_read
(
struct
file
*
file
,
char
*
buf
,
flash_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
size_t
count
,
loff_t
*
ppos
)
{
{
unsigned
long
p
=
file
->
f_pos
;
unsigned
long
p
=
file
->
f_pos
;
...
...
drivers/sbus/char/openprom.c
View file @
0bc20408
...
@@ -67,7 +67,7 @@ static int options_node = 0;
...
@@ -67,7 +67,7 @@ static int options_node = 0;
* structure will be placed in "*opp_p". Return value is the length
* structure will be placed in "*opp_p". Return value is the length
* of the user supplied buffer.
* of the user supplied buffer.
*/
*/
static
int
copyin
(
struct
openpromio
*
info
,
struct
openpromio
**
opp_p
)
static
int
copyin
(
struct
openpromio
__user
*
info
,
struct
openpromio
**
opp_p
)
{
{
unsigned
int
bufsize
;
unsigned
int
bufsize
;
...
@@ -98,7 +98,7 @@ static int copyin(struct openpromio *info, struct openpromio **opp_p)
...
@@ -98,7 +98,7 @@ static int copyin(struct openpromio *info, struct openpromio **opp_p)
return
bufsize
;
return
bufsize
;
}
}
static
int
getstrings
(
struct
openpromio
*
info
,
struct
openpromio
**
opp_p
)
static
int
getstrings
(
struct
openpromio
__user
*
info
,
struct
openpromio
**
opp_p
)
{
{
int
n
,
bufsize
;
int
n
,
bufsize
;
char
c
;
char
c
;
...
@@ -132,7 +132,7 @@ static int getstrings(struct openpromio *info, struct openpromio **opp_p)
...
@@ -132,7 +132,7 @@ static int getstrings(struct openpromio *info, struct openpromio **opp_p)
/*
/*
* Copy an openpromio structure in kernel space back to user space.
* Copy an openpromio structure in kernel space back to user space.
*/
*/
static
int
copyout
(
void
*
info
,
struct
openpromio
*
opp
,
int
len
)
static
int
copyout
(
void
__user
*
info
,
struct
openpromio
*
opp
,
int
len
)
{
{
if
(
copy_to_user
(
info
,
opp
,
len
))
if
(
copy_to_user
(
info
,
opp
,
len
))
return
-
EFAULT
;
return
-
EFAULT
;
...
@@ -150,11 +150,12 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -150,11 +150,12 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
struct
openpromio
*
opp
;
struct
openpromio
*
opp
;
int
bufsize
,
len
,
error
=
0
;
int
bufsize
,
len
,
error
=
0
;
static
int
cnt
;
static
int
cnt
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
if
(
cmd
==
OPROMSETOPT
)
if
(
cmd
==
OPROMSETOPT
)
bufsize
=
getstrings
(
(
void
*
)
arg
,
&
opp
);
bufsize
=
getstrings
(
argp
,
&
opp
);
else
else
bufsize
=
copyin
(
(
void
*
)
arg
,
&
opp
);
bufsize
=
copyin
(
argp
,
&
opp
);
if
(
bufsize
<
0
)
if
(
bufsize
<
0
)
return
bufsize
;
return
bufsize
;
...
@@ -165,7 +166,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -165,7 +166,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
len
=
prom_getproplen
(
node
,
opp
->
oprom_array
);
len
=
prom_getproplen
(
node
,
opp
->
oprom_array
);
if
(
len
<=
0
||
len
>
bufsize
)
{
if
(
len
<=
0
||
len
>
bufsize
)
{
error
=
copyout
(
(
void
*
)
arg
,
opp
,
sizeof
(
int
));
error
=
copyout
(
argp
,
opp
,
sizeof
(
int
));
break
;
break
;
}
}
...
@@ -175,7 +176,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -175,7 +176,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
opp
->
oprom_array
[
len
]
=
'\0'
;
opp
->
oprom_array
[
len
]
=
'\0'
;
opp
->
oprom_size
=
len
;
opp
->
oprom_size
=
len
;
error
=
copyout
(
(
void
*
)
arg
,
opp
,
sizeof
(
int
)
+
bufsize
);
error
=
copyout
(
argp
,
opp
,
sizeof
(
int
)
+
bufsize
);
break
;
break
;
case
OPROMNXTOPT
:
case
OPROMNXTOPT
:
...
@@ -184,7 +185,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -184,7 +185,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
len
=
strlen
(
buf
);
len
=
strlen
(
buf
);
if
(
len
==
0
||
len
+
1
>
bufsize
)
{
if
(
len
==
0
||
len
+
1
>
bufsize
)
{
error
=
copyout
(
(
void
*
)
arg
,
opp
,
sizeof
(
int
));
error
=
copyout
(
argp
,
opp
,
sizeof
(
int
));
break
;
break
;
}
}
...
@@ -192,7 +193,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -192,7 +193,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
opp
->
oprom_array
[
len
]
=
'\0'
;
opp
->
oprom_array
[
len
]
=
'\0'
;
opp
->
oprom_size
=
++
len
;
opp
->
oprom_size
=
++
len
;
error
=
copyout
(
(
void
*
)
arg
,
opp
,
sizeof
(
int
)
+
bufsize
);
error
=
copyout
(
argp
,
opp
,
sizeof
(
int
)
+
bufsize
);
break
;
break
;
case
OPROMSETOPT
:
case
OPROMSETOPT
:
...
@@ -227,7 +228,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -227,7 +228,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
*
((
int
*
)
opp
->
oprom_array
)
=
node
;
*
((
int
*
)
opp
->
oprom_array
)
=
node
;
opp
->
oprom_size
=
sizeof
(
int
);
opp
->
oprom_size
=
sizeof
(
int
);
error
=
copyout
(
(
void
*
)
arg
,
opp
,
bufsize
+
sizeof
(
int
));
error
=
copyout
(
argp
,
opp
,
bufsize
+
sizeof
(
int
));
break
;
break
;
case
OPROMPCI2NODE
:
case
OPROMPCI2NODE
:
...
@@ -246,7 +247,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -246,7 +247,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
data
->
current_node
=
node
;
data
->
current_node
=
node
;
*
((
int
*
)
opp
->
oprom_array
)
=
node
;
*
((
int
*
)
opp
->
oprom_array
)
=
node
;
opp
->
oprom_size
=
sizeof
(
int
);
opp
->
oprom_size
=
sizeof
(
int
);
error
=
copyout
(
(
void
*
)
arg
,
opp
,
bufsize
+
sizeof
(
int
));
error
=
copyout
(
argp
,
opp
,
bufsize
+
sizeof
(
int
));
}
}
#endif
#endif
}
}
...
@@ -258,7 +259,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -258,7 +259,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
*
((
int
*
)
opp
->
oprom_array
)
=
node
;
*
((
int
*
)
opp
->
oprom_array
)
=
node
;
opp
->
oprom_size
=
sizeof
(
int
);
opp
->
oprom_size
=
sizeof
(
int
);
error
=
copyout
(
(
void
*
)
arg
,
opp
,
bufsize
+
sizeof
(
int
));
error
=
copyout
(
argp
,
opp
,
bufsize
+
sizeof
(
int
));
break
;
break
;
case
OPROMGETBOOTARGS
:
case
OPROMGETBOOTARGS
:
...
@@ -274,7 +275,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
...
@@ -274,7 +275,7 @@ static int openprom_sunos_ioctl(struct inode * inode, struct file * file,
strcpy
(
opp
->
oprom_array
,
buf
);
strcpy
(
opp
->
oprom_array
,
buf
);
opp
->
oprom_size
=
len
;
opp
->
oprom_size
=
len
;
error
=
copyout
(
(
void
*
)
arg
,
opp
,
bufsize
+
sizeof
(
int
));
error
=
copyout
(
argp
,
opp
,
bufsize
+
sizeof
(
int
));
break
;
break
;
case
OPROMU2P
:
case
OPROMU2P
:
...
@@ -317,7 +318,7 @@ static int goodnode(int n, DATA *data)
...
@@ -317,7 +318,7 @@ static int goodnode(int n, DATA *data)
}
}
/* Copy in a whole string from userspace into kernelspace. */
/* Copy in a whole string from userspace into kernelspace. */
static
int
copyin_string
(
char
*
user
,
size_t
len
,
char
**
ptr
)
static
int
copyin_string
(
char
__user
*
user
,
size_t
len
,
char
**
ptr
)
{
{
char
*
tmp
;
char
*
tmp
;
...
@@ -347,6 +348,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -347,6 +348,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
unsigned
int
cmd
,
unsigned
long
arg
)
unsigned
int
cmd
,
unsigned
long
arg
)
{
{
DATA
*
data
=
(
DATA
*
)
file
->
private_data
;
DATA
*
data
=
(
DATA
*
)
file
->
private_data
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
struct
opiocdesc
op
;
struct
opiocdesc
op
;
int
error
,
node
,
len
;
int
error
,
node
,
len
;
char
*
str
,
*
tmp
;
char
*
str
,
*
tmp
;
...
@@ -355,7 +357,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -355,7 +357,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
switch
(
cmd
)
{
switch
(
cmd
)
{
case
OPIOCGET
:
case
OPIOCGET
:
if
(
copy_from_user
(
&
op
,
(
void
*
)
arg
,
sizeof
(
op
)))
if
(
copy_from_user
(
&
op
,
argp
,
sizeof
(
op
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
!
goodnode
(
op
.
op_nodeid
,
data
))
if
(
!
goodnode
(
op
.
op_nodeid
,
data
))
...
@@ -377,7 +379,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -377,7 +379,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
if
(
len
<=
0
)
{
if
(
len
<=
0
)
{
kfree
(
str
);
kfree
(
str
);
/* Verified by the above copy_from_user */
/* Verified by the above copy_from_user */
if
(
__copy_to_user
(
(
void
*
)
arg
,
&
op
,
if
(
__copy_to_user
(
argp
,
&
op
,
sizeof
(
op
)))
sizeof
(
op
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -393,7 +395,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -393,7 +395,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
tmp
[
len
]
=
'\0'
;
tmp
[
len
]
=
'\0'
;
if
(
__copy_to_user
(
(
void
*
)
arg
,
&
op
,
sizeof
(
op
))
!=
0
if
(
__copy_to_user
(
argp
,
&
op
,
sizeof
(
op
))
!=
0
||
copy_to_user
(
op
.
op_buf
,
tmp
,
len
)
!=
0
)
||
copy_to_user
(
op
.
op_buf
,
tmp
,
len
)
!=
0
)
error
=
-
EFAULT
;
error
=
-
EFAULT
;
...
@@ -403,7 +405,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -403,7 +405,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
return
error
;
return
error
;
case
OPIOCNEXTPROP
:
case
OPIOCNEXTPROP
:
if
(
copy_from_user
(
&
op
,
(
void
*
)
arg
,
sizeof
(
op
)))
if
(
copy_from_user
(
&
op
,
argp
,
sizeof
(
op
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
!
goodnode
(
op
.
op_nodeid
,
data
))
if
(
!
goodnode
(
op
.
op_nodeid
,
data
))
...
@@ -425,7 +427,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -425,7 +427,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
len
=
op
.
op_buflen
=
0
;
len
=
op
.
op_buflen
=
0
;
}
}
error
=
verify_area
(
VERIFY_WRITE
,
(
void
*
)
arg
,
sizeof
(
op
));
error
=
verify_area
(
VERIFY_WRITE
,
argp
,
sizeof
(
op
));
if
(
error
)
{
if
(
error
)
{
kfree
(
str
);
kfree
(
str
);
return
error
;
return
error
;
...
@@ -437,7 +439,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -437,7 +439,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
return
error
;
return
error
;
}
}
error
=
__copy_to_user
(
(
void
*
)
arg
,
&
op
,
sizeof
(
op
));
error
=
__copy_to_user
(
argp
,
&
op
,
sizeof
(
op
));
if
(
!
error
)
error
=
__copy_to_user
(
op
.
op_buf
,
tmp
,
len
);
if
(
!
error
)
error
=
__copy_to_user
(
op
.
op_buf
,
tmp
,
len
);
kfree
(
str
);
kfree
(
str
);
...
@@ -445,7 +447,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -445,7 +447,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
return
error
;
return
error
;
case
OPIOCSET
:
case
OPIOCSET
:
if
(
copy_from_user
(
&
op
,
(
void
*
)
arg
,
sizeof
(
op
)))
if
(
copy_from_user
(
&
op
,
argp
,
sizeof
(
op
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
!
goodnode
(
op
.
op_nodeid
,
data
))
if
(
!
goodnode
(
op
.
op_nodeid
,
data
))
...
@@ -472,13 +474,13 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -472,13 +474,13 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
return
0
;
return
0
;
case
OPIOCGETOPTNODE
:
case
OPIOCGETOPTNODE
:
if
(
copy_to_user
(
(
void
*
)
arg
,
&
options_node
,
sizeof
(
int
)))
if
(
copy_to_user
(
argp
,
&
options_node
,
sizeof
(
int
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
case
OPIOCGETNEXT
:
case
OPIOCGETNEXT
:
case
OPIOCGETCHILD
:
case
OPIOCGETCHILD
:
if
(
copy_from_user
(
&
node
,
(
void
*
)
arg
,
sizeof
(
int
)))
if
(
copy_from_user
(
&
node
,
argp
,
sizeof
(
int
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
cmd
==
OPIOCGETNEXT
)
if
(
cmd
==
OPIOCGETNEXT
)
...
@@ -486,7 +488,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
...
@@ -486,7 +488,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
else
else
node
=
__prom_getchild
(
node
);
node
=
__prom_getchild
(
node
);
if
(
__copy_to_user
(
(
void
*
)
arg
,
&
node
,
sizeof
(
int
)))
if
(
__copy_to_user
(
argp
,
&
node
,
sizeof
(
int
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
...
drivers/sbus/char/riowatchdog.c
View file @
0bc20408
...
@@ -130,18 +130,19 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
...
@@ -130,18 +130,19 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
static
struct
watchdog_info
info
=
{
static
struct
watchdog_info
info
=
{
WDIOF_SETTIMEOUT
,
0
,
"Natl. Semiconductor PC97317"
WDIOF_SETTIMEOUT
,
0
,
"Natl. Semiconductor PC97317"
};
};
void
__user
*
argp
=
(
void
__user
*
)
arg
;
unsigned
int
options
;
unsigned
int
options
;
int
new_margin
;
int
new_margin
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
case
WDIOC_GETSUPPORT
:
if
(
copy_to_user
(
(
struct
watchdog_info
*
)
arg
,
&
info
,
sizeof
(
info
)))
if
(
copy_to_user
(
argp
,
&
info
,
sizeof
(
info
)))
return
-
EFAULT
;
return
-
EFAULT
;
break
;
break
;
case
WDIOC_GETSTATUS
:
case
WDIOC_GETSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
case
WDIOC_GETBOOTSTATUS
:
if
(
put_user
(
0
,
(
int
*
)
arg
))
if
(
put_user
(
0
,
(
int
__user
*
)
argp
))
return
-
EFAULT
;
return
-
EFAULT
;
break
;
break
;
...
@@ -150,7 +151,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
...
@@ -150,7 +151,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
break
;
break
;
case
WDIOC_SETOPTIONS
:
case
WDIOC_SETOPTIONS
:
if
(
copy_from_user
(
&
options
,
(
void
*
)
arg
,
sizeof
(
options
)))
if
(
copy_from_user
(
&
options
,
argp
,
sizeof
(
options
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
options
&
WDIOS_DISABLECARD
)
if
(
options
&
WDIOS_DISABLECARD
)
...
@@ -163,7 +164,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
...
@@ -163,7 +164,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
break
;
break
;
case
WDIOC_SETTIMEOUT
:
case
WDIOC_SETTIMEOUT
:
if
(
get_user
(
new_margin
,
(
int
*
)
arg
))
if
(
get_user
(
new_margin
,
(
int
__user
*
)
argp
))
return
-
EFAULT
;
return
-
EFAULT
;
if
((
new_margin
<
60
)
||
(
new_margin
>
(
255
*
60
)))
if
((
new_margin
<
60
)
||
(
new_margin
>
(
255
*
60
)))
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -172,7 +173,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
...
@@ -172,7 +173,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
/* Fall */
/* Fall */
case
WDIOC_GETTIMEOUT
:
case
WDIOC_GETTIMEOUT
:
return
put_user
(
riowd_timeout
*
60
,
(
int
*
)
arg
);
return
put_user
(
riowd_timeout
*
60
,
(
int
__user
*
)
argp
);
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -181,7 +182,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
...
@@ -181,7 +182,7 @@ static int riowd_ioctl(struct inode *inode, struct file *filp,
return
0
;
return
0
;
}
}
static
ssize_t
riowd_write
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
static
ssize_t
riowd_write
(
struct
file
*
file
,
const
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
{
if
(
ppos
!=
&
file
->
f_pos
)
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
return
-
ESPIPE
;
...
...
drivers/sbus/char/rtc.c
View file @
0bc20408
...
@@ -85,6 +85,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -85,6 +85,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned
long
arg
)
unsigned
long
arg
)
{
{
struct
rtc_time
rtc_tm
;
struct
rtc_time
rtc_tm
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
switch
(
cmd
)
switch
(
cmd
)
{
{
...
@@ -92,7 +93,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -92,7 +93,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
memset
(
&
rtc_tm
,
0
,
sizeof
(
struct
rtc_time
));
memset
(
&
rtc_tm
,
0
,
sizeof
(
struct
rtc_time
));
get_rtc_time
(
&
rtc_tm
);
get_rtc_time
(
&
rtc_tm
);
if
(
copy_to_user
(
(
struct
rtc_time
*
)
arg
,
&
rtc_tm
,
sizeof
(
struct
rtc_time
)))
if
(
copy_to_user
(
argp
,
&
rtc_tm
,
sizeof
(
struct
rtc_time
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
...
@@ -102,7 +103,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -102,7 +103,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if
(
!
capable
(
CAP_SYS_TIME
))
if
(
!
capable
(
CAP_SYS_TIME
))
return
-
EPERM
;
return
-
EPERM
;
if
(
copy_from_user
(
&
rtc_tm
,
(
struct
rtc_time
*
)
arg
,
sizeof
(
struct
rtc_time
)))
if
(
copy_from_user
(
&
rtc_tm
,
argp
,
sizeof
(
struct
rtc_time
)))
return
-
EFAULT
;
return
-
EFAULT
;
set_rtc_time
(
&
rtc_tm
);
set_rtc_time
(
&
rtc_tm
);
...
...
drivers/sbus/char/vfc_dev.c
View file @
0bc20408
...
@@ -226,7 +226,7 @@ static int vfc_release(struct inode *inode,struct file *file)
...
@@ -226,7 +226,7 @@ static int vfc_release(struct inode *inode,struct file *file)
return
0
;
return
0
;
}
}
static
int
vfc_debug
(
struct
vfc_dev
*
dev
,
int
cmd
,
unsigned
long
arg
)
static
int
vfc_debug
(
struct
vfc_dev
*
dev
,
int
cmd
,
void
__user
*
argp
)
{
{
struct
vfc_debug_inout
inout
;
struct
vfc_debug_inout
inout
;
unsigned
char
*
buffer
;
unsigned
char
*
buffer
;
...
@@ -236,15 +236,14 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
...
@@ -236,15 +236,14 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
switch
(
cmd
)
{
switch
(
cmd
)
{
case
VFC_I2C_SEND
:
case
VFC_I2C_SEND
:
if
(
copy_from_user
(
&
inout
,
(
void
*
)
arg
,
sizeof
(
inout
)))
if
(
copy_from_user
(
&
inout
,
argp
,
sizeof
(
inout
)))
return
-
EFAULT
;
return
-
EFAULT
;
buffer
=
kmalloc
(
inout
.
len
*
sizeof
(
char
)
,
GFP_KERNEL
);
buffer
=
kmalloc
(
inout
.
len
,
GFP_KERNEL
);
if
(
buffer
==
NULL
)
if
(
buffer
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
if
(
copy_from_user
(
buffer
,
inout
.
buffer
,
if
(
copy_from_user
(
buffer
,
inout
.
buffer
,
inout
.
len
))
{
inout
.
len
*
sizeof
(
char
)))
{
kfree
(
buffer
);
kfree
(
buffer
);
return
-
EFAULT
;
return
-
EFAULT
;
}
}
...
@@ -255,7 +254,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
...
@@ -255,7 +254,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
vfc_i2c_sendbuf
(
dev
,
inout
.
addr
&
0xff
,
vfc_i2c_sendbuf
(
dev
,
inout
.
addr
&
0xff
,
buffer
,
inout
.
len
);
buffer
,
inout
.
len
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
inout
,
sizeof
(
inout
)))
{
if
(
copy_to_user
(
argp
,
&
inout
,
sizeof
(
inout
)))
{
kfree
(
buffer
);
kfree
(
buffer
);
return
-
EFAULT
;
return
-
EFAULT
;
}
}
...
@@ -263,14 +262,14 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
...
@@ -263,14 +262,14 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
break
;
break
;
case
VFC_I2C_RECV
:
case
VFC_I2C_RECV
:
if
(
copy_from_user
(
&
inout
,
(
void
*
)
arg
,
sizeof
(
inout
)))
if
(
copy_from_user
(
&
inout
,
argp
,
sizeof
(
inout
)))
return
-
EFAULT
;
return
-
EFAULT
;
buffer
=
kmalloc
(
inout
.
len
,
GFP_KERNEL
);
buffer
=
kmalloc
(
inout
.
len
,
GFP_KERNEL
);
if
(
buffer
==
NULL
)
if
(
buffer
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
memset
(
buffer
,
0
,
inout
.
len
*
sizeof
(
char
)
);
memset
(
buffer
,
0
,
inout
.
len
);
vfc_lock_device
(
dev
);
vfc_lock_device
(
dev
);
inout
.
ret
=
inout
.
ret
=
vfc_i2c_recvbuf
(
dev
,
inout
.
addr
&
0xff
vfc_i2c_recvbuf
(
dev
,
inout
.
addr
&
0xff
...
@@ -281,7 +280,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
...
@@ -281,7 +280,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg)
kfree
(
buffer
);
kfree
(
buffer
);
return
-
EFAULT
;
return
-
EFAULT
;
}
}
if
(
copy_to_user
(
(
void
*
)
arg
,
&
inout
,
sizeof
(
inout
)))
{
if
(
copy_to_user
(
argp
,
&
inout
,
sizeof
(
inout
)))
{
kfree
(
buffer
);
kfree
(
buffer
);
return
-
EFAULT
;
return
-
EFAULT
;
}
}
...
@@ -340,7 +339,7 @@ static int vfc_set_control_ioctl(struct inode *inode, struct file *file,
...
@@ -340,7 +339,7 @@ static int vfc_set_control_ioctl(struct inode *inode, struct file *file,
{
{
int
setcmd
,
ret
=
0
;
int
setcmd
,
ret
=
0
;
if
(
copy_from_user
(
&
setcmd
,(
void
*
)
arg
,
sizeof
(
unsigned
int
)))
if
(
copy_from_user
(
&
setcmd
,(
void
__user
*
)
arg
,
sizeof
(
unsigned
int
)))
return
-
EFAULT
;
return
-
EFAULT
;
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCSCTRL) arg=0x%x
\n
"
,
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCSCTRL) arg=0x%x
\n
"
,
...
@@ -398,7 +397,7 @@ int vfc_port_change_ioctl(struct inode *inode, struct file *file,
...
@@ -398,7 +397,7 @@ int vfc_port_change_ioctl(struct inode *inode, struct file *file,
int
ret
=
0
;
int
ret
=
0
;
int
cmd
;
int
cmd
;
if
(
copy_from_user
(
&
cmd
,
(
void
*
)
arg
,
sizeof
(
unsigned
int
)))
{
if
(
copy_from_user
(
&
cmd
,
(
void
__user
*
)
arg
,
sizeof
(
unsigned
int
)))
{
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer to "
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer to "
"vfc_port_change_ioctl
\n
"
,
"vfc_port_change_ioctl
\n
"
,
dev
->
instance
));
dev
->
instance
));
...
@@ -468,7 +467,7 @@ int vfc_set_video_ioctl(struct inode *inode, struct file *file,
...
@@ -468,7 +467,7 @@ int vfc_set_video_ioctl(struct inode *inode, struct file *file,
int
ret
=
0
;
int
ret
=
0
;
int
cmd
;
int
cmd
;
if
(
copy_from_user
(
&
cmd
,
(
void
*
)
arg
,
sizeof
(
unsigned
int
)))
{
if
(
copy_from_user
(
&
cmd
,
(
void
__user
*
)
arg
,
sizeof
(
unsigned
int
)))
{
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer to "
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer to "
"vfc_set_video_ioctl
\n
"
,
"vfc_set_video_ioctl
\n
"
,
dev
->
instance
));
dev
->
instance
));
...
@@ -542,7 +541,7 @@ int vfc_get_video_ioctl(struct inode *inode, struct file *file,
...
@@ -542,7 +541,7 @@ int vfc_get_video_ioctl(struct inode *inode, struct file *file,
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCGVID) returning status 0x%x; "
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCGVID) returning status 0x%x; "
"buf[0]=%x
\n
"
,
dev
->
instance
,
status
,
buf
[
0
]));
"buf[0]=%x
\n
"
,
dev
->
instance
,
status
,
buf
[
0
]));
if
(
copy_to_user
((
void
*
)
arg
,
&
status
,
sizeof
(
unsigned
int
)))
{
if
(
copy_to_user
((
void
__user
*
)
arg
,
&
status
,
sizeof
(
unsigned
int
)))
{
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer to "
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer to "
"vfc_get_video_ioctl
\n
"
,
"vfc_get_video_ioctl
\n
"
,
dev
->
instance
));
dev
->
instance
));
...
@@ -557,6 +556,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -557,6 +556,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
int
ret
=
0
;
int
ret
=
0
;
unsigned
int
tmp
;
unsigned
int
tmp
;
struct
vfc_dev
*
dev
;
struct
vfc_dev
*
dev
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
dev
=
vfc_get_dev_ptr
(
iminor
(
inode
));
dev
=
vfc_get_dev_ptr
(
iminor
(
inode
));
if
(
dev
==
NULL
)
if
(
dev
==
NULL
)
...
@@ -568,7 +568,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -568,7 +568,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
VFC_IOCTL_DEBUG_PRINTK(("vfc%d: IOCTL(VFCGCTRL)\n", dev->instance));
VFC_IOCTL_DEBUG_PRINTK(("vfc%d: IOCTL(VFCGCTRL)\n", dev->instance));
#endif
#endif
tmp
=
sbus_readl
(
&
dev
->
regs
->
control
);
tmp
=
sbus_readl
(
&
dev
->
regs
->
control
);
if
(
copy_to_user
(
(
void
*
)
arg
,
&
tmp
,
sizeof
(
unsigned
int
)))
{
if
(
copy_to_user
(
argp
,
&
tmp
,
sizeof
(
unsigned
int
)))
{
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
break
;
break
;
}
}
...
@@ -585,7 +585,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -585,7 +585,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break
;
break
;
case
VFCHUE
:
case
VFCHUE
:
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCHUE)
\n
"
,
dev
->
instance
));
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCHUE)
\n
"
,
dev
->
instance
));
if
(
copy_from_user
(
&
tmp
,
(
void
*
)
arg
,
sizeof
(
unsigned
int
)))
{
if
(
copy_from_user
(
&
tmp
,
argp
,
sizeof
(
unsigned
int
)))
{
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer "
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: User passed bogus pointer "
"to IOCTL(VFCHUE)"
,
dev
->
instance
));
"to IOCTL(VFCHUE)"
,
dev
->
instance
));
ret
=
-
EFAULT
;
ret
=
-
EFAULT
;
...
@@ -603,8 +603,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -603,8 +603,7 @@ static int vfc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCRDINFO)
\n
"
,
dev
->
instance
));
VFC_IOCTL_DEBUG_PRINTK
((
"vfc%d: IOCTL(VFCRDINFO)
\n
"
,
dev
->
instance
));
break
;
break
;
default:
default:
ret
=
vfc_debug
(
vfc_get_dev_ptr
(
iminor
(
inode
)),
ret
=
vfc_debug
(
vfc_get_dev_ptr
(
iminor
(
inode
)),
cmd
,
argp
);
cmd
,
arg
);
break
;
break
;
};
};
...
...
include/asm-sparc/vfc_ioctls.h
View file @
0bc20408
...
@@ -52,7 +52,7 @@ struct vfc_debug_inout
...
@@ -52,7 +52,7 @@ struct vfc_debug_inout
unsigned
long
addr
;
unsigned
long
addr
;
unsigned
long
ret
;
unsigned
long
ret
;
unsigned
long
len
;
unsigned
long
len
;
unsigned
char
*
buffer
;
unsigned
char
__user
*
buffer
;
};
};
#endif
/* _LINUX_VFC_IOCTLS_H_ */
#endif
/* _LINUX_VFC_IOCTLS_H_ */
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