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
bd12c17c
Commit
bd12c17c
authored
Jun 03, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jun 03, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: drivers/cdrom annotation
parent
4743adaa
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
97 deletions
+83
-97
drivers/cdrom/aztcd.c
drivers/cdrom/aztcd.c
+18
-27
drivers/cdrom/cdu31a.c
drivers/cdrom/cdu31a.c
+6
-7
drivers/cdrom/optcd.c
drivers/cdrom/optcd.c
+34
-33
drivers/cdrom/sjcd.c
drivers/cdrom/sjcd.c
+14
-17
drivers/cdrom/sonycd535.c
drivers/cdrom/sonycd535.c
+11
-13
No files found.
drivers/cdrom/aztcd.c
View file @
bd12c17c
...
...
@@ -873,7 +873,7 @@ static int aztUpdateToc(void)
/* Read the table of contents header, i.e. no. of tracks and start of first
* track
*/
static
int
aztGetDiskInfo
()
static
int
aztGetDiskInfo
(
void
)
{
int
limit
;
unsigned
char
test
;
...
...
@@ -1167,6 +1167,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
struct
azt_Toc
*
tocPtr
;
struct
cdrom_subchnl
subchnl
;
struct
cdrom_volctrl
volctrl
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
#ifdef AZT_DEBUG
printk
(
"aztcd: starting aztcd_ioctl - Command:%x Time: %li
\n
"
,
...
...
@@ -1230,8 +1231,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
#ifdef AZT_DEBUG
printk
(
"aztcd ioctl MULTISESSION
\n
"
);
#endif
if
(
copy_from_user
(
&
ms
,
(
void
*
)
arg
,
if
(
copy_from_user
(
&
ms
,
argp
,
sizeof
(
struct
cdrom_multisession
)))
return
-
EFAULT
;
if
(
ms
.
addr_format
==
CDROM_MSF
)
{
...
...
@@ -1248,8 +1248,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
else
return
-
EINVAL
;
ms
.
xa_flag
=
DiskInfo
.
xa
;
if
(
copy_to_user
((
void
*
)
arg
,
&
ms
,
if
(
copy_to_user
(
argp
,
&
ms
,
sizeof
(
struct
cdrom_multisession
)))
return
-
EFAULT
;
#ifdef AZT_DEBUG
...
...
@@ -1272,7 +1271,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
return
0
;
}
case
CDROMPLAYTRKIND
:
/* Play a track. This currently ignores index. */
if
(
copy_from_user
(
&
ti
,
(
void
*
)
arg
,
sizeof
ti
))
if
(
copy_from_user
(
&
ti
,
argp
,
sizeof
ti
))
return
-
EFAULT
;
if
(
ti
.
cdti_trk0
<
DiskInfo
.
first
||
ti
.
cdti_trk0
>
DiskInfo
.
last
...
...
@@ -1303,7 +1302,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
aztAudioStatus = CDROM_AUDIO_NO_STATUS;
}
*/
if
(
copy_from_user
(
&
msf
,
(
void
*
)
arg
,
sizeof
msf
))
if
(
copy_from_user
(
&
msf
,
argp
,
sizeof
msf
))
return
-
EFAULT
;
/* convert to bcd */
azt_bin2bcd
(
&
msf
.
cdmsf_min0
);
...
...
@@ -1335,11 +1334,11 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
case
CDROMREADTOCHDR
:
/* Read the table of contents header */
tocHdr
.
cdth_trk0
=
DiskInfo
.
first
;
tocHdr
.
cdth_trk1
=
DiskInfo
.
last
;
if
(
copy_to_user
(
(
void
*
)
arg
,
&
tocHdr
,
sizeof
tocHdr
))
if
(
copy_to_user
(
argp
,
&
tocHdr
,
sizeof
tocHdr
))
return
-
EFAULT
;
break
;
case
CDROMREADTOCENTRY
:
/* Read an entry in the table of contents */
if
(
copy_from_user
(
&
entry
,
(
void
*
)
arg
,
sizeof
entry
))
if
(
copy_from_user
(
&
entry
,
argp
,
sizeof
entry
))
return
-
EFAULT
;
if
((
!
aztTocUpToDate
)
||
aztDiskChanged
)
aztUpdateToc
();
...
...
@@ -1365,12 +1364,12 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
}
else
{
return
-
EINVAL
;
}
if
(
copy_to_user
(
(
void
*
)
arg
,
&
entry
,
sizeof
entry
))
if
(
copy_to_user
(
argp
,
&
entry
,
sizeof
entry
))
return
-
EFAULT
;
break
;
case
CDROMSUBCHNL
:
/* Get subchannel info */
if
(
copy_from_user
(
&
subchnl
,
(
void
*
)
arg
,
sizeof
(
struct
cdrom_subchnl
)))
(
&
subchnl
,
argp
,
sizeof
(
struct
cdrom_subchnl
)))
return
-
EFAULT
;
if
(
aztGetQChannelInfo
(
&
qInfo
)
<
0
)
{
#ifdef AZT_DEBUG
...
...
@@ -1405,16 +1404,14 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
subchnl
.
cdsc_reladdr
.
msf
.
frame
=
azt_bcd2bin
(
qInfo
.
trackTime
.
frame
);
}
if
(
copy_to_user
((
void
*
)
arg
,
&
subchnl
,
sizeof
(
struct
cdrom_subchnl
)))
if
(
copy_to_user
(
argp
,
&
subchnl
,
sizeof
(
struct
cdrom_subchnl
)))
return
-
EFAULT
;
break
;
case
CDROMVOLCTRL
:
/* Volume control
* With my Aztech CD268-01A volume control does not work, I can only
turn the channels on (any value !=0) or off (value==0). Maybe it
works better with your drive */
if
(
copy_from_user
(
&
volctrl
,
(
char
*
)
arg
,
sizeof
(
volctrl
)))
if
(
copy_from_user
(
&
volctrl
,
argp
,
sizeof
(
volctrl
)))
return
-
EFAULT
;
azt_Play
.
start
.
min
=
0x21
;
azt_Play
.
start
.
sec
=
0x84
;
...
...
@@ -1457,7 +1454,7 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
case
CDROMREADCOOKED
:
/*read data in mode 1 (2048 Bytes) */
case
CDROMREADRAW
:
/*read data in mode 2 (2336 Bytes) */
{
if
(
copy_from_user
(
&
msf
,
(
void
*
)
arg
,
sizeof
msf
))
if
(
copy_from_user
(
&
msf
,
argp
,
sizeof
msf
))
return
-
EFAULT
;
/* convert to bcd */
azt_bin2bcd
(
&
msf
.
cdmsf_min0
);
...
...
@@ -1476,16 +1473,11 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
if
(
DiskInfo
.
xa
)
{
return
-
1
;
/*XA Disks can't be read raw */
}
else
{
if
(
sendAztCmd
(
ACMD_PLAY_READ_RAW
,
&
azt_Play
))
if
(
sendAztCmd
(
ACMD_PLAY_READ_RAW
,
&
azt_Play
))
return
-
1
;
DTEN_LOW
;
insb
(
DATA_PORT
,
buf
,
CD_FRAMESIZE_RAW
);
if
(
copy_to_user
((
void
*
)
arg
,
&
buf
,
CD_FRAMESIZE_RAW
))
insb
(
DATA_PORT
,
buf
,
CD_FRAMESIZE_RAW
);
if
(
copy_to_user
(
argp
,
&
buf
,
CD_FRAMESIZE_RAW
))
return
-
EFAULT
;
}
}
else
...
...
@@ -1494,14 +1486,13 @@ static int aztcd_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
return
-
1
;
DTEN_LOW
;
insb
(
DATA_PORT
,
buf
,
CD_FRAMESIZE
);
if
(
copy_to_user
((
void
*
)
arg
,
&
buf
,
CD_FRAMESIZE
))
if
(
copy_to_user
(
argp
,
&
buf
,
CD_FRAMESIZE
))
return
-
EFAULT
;
}
}
break
;
case
CDROMSEEK
:
/*seek msf address */
if
(
copy_from_user
(
&
msf
,
(
void
*
)
arg
,
sizeof
msf
))
if
(
copy_from_user
(
&
msf
,
argp
,
sizeof
msf
))
return
-
EFAULT
;
/* convert to bcd */
azt_bin2bcd
(
&
msf
.
cdmsf_min0
);
...
...
drivers/cdrom/cdu31a.c
View file @
bd12c17c
...
...
@@ -2595,11 +2595,10 @@ static int read_audio(struct cdrom_read_audio *ra)
retval
=
-
EIO
;
goto
exit_read_audio
;
}
}
else
if
(
copy_to_user
(
(
char
*
)(
ra
->
buf
+
}
else
if
(
copy_to_user
(
ra
->
buf
+
(
CD_FRAMESIZE_RAW
*
cframe
)),
(
char
*
)
readahead_buffer
,
*
cframe
),
readahead_buffer
,
CD_FRAMESIZE_RAW
))
{
retval
=
-
EFAULT
;
goto
exit_read_audio
;
...
...
@@ -2612,8 +2611,7 @@ static int read_audio(struct cdrom_read_audio *ra)
retval
=
-
EIO
;
goto
exit_read_audio
;
}
}
else
if
(
copy_to_user
((
char
*
)(
ra
->
buf
+
(
CD_FRAMESIZE_RAW
*
cframe
)),
}
else
if
(
copy_to_user
(
ra
->
buf
+
(
CD_FRAMESIZE_RAW
*
cframe
),
(
char
*
)
readahead_buffer
,
CD_FRAMESIZE_RAW
))
{
retval
=
-
EFAULT
;
...
...
@@ -2945,6 +2943,7 @@ static int scd_audio_ioctl(struct cdrom_device_info *cdi,
static
int
scd_dev_ioctl
(
struct
cdrom_device_info
*
cdi
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
int
i
;
switch
(
cmd
)
{
...
...
@@ -2959,7 +2958,7 @@ static int scd_dev_ioctl(struct cdrom_device_info *cdi,
return
-
EIO
;
}
if
(
copy_from_user
(
&
ra
,
(
char
*
)
arg
,
sizeof
(
ra
)))
if
(
copy_from_user
(
&
ra
,
argp
,
sizeof
(
ra
)))
return
-
EFAULT
;
if
(
ra
.
nframes
==
0
)
{
...
...
drivers/cdrom/optcd.c
View file @
bd12c17c
...
...
@@ -1440,12 +1440,12 @@ static int cdromresume(void)
}
static
int
cdromplaymsf
(
unsigned
long
arg
)
static
int
cdromplaymsf
(
void
__user
*
arg
)
{
int
status
;
struct
cdrom_msf
msf
;
if
(
copy_from_user
(
&
msf
,
(
void
*
)
arg
,
sizeof
msf
))
if
(
copy_from_user
(
&
msf
,
arg
,
sizeof
msf
))
return
-
EFAULT
;
bin2bcd
(
&
msf
);
...
...
@@ -1461,13 +1461,13 @@ static int cdromplaymsf(unsigned long arg)
}
static
int
cdromplaytrkind
(
unsigned
long
arg
)
static
int
cdromplaytrkind
(
void
__user
*
arg
)
{
int
status
;
struct
cdrom_ti
ti
;
struct
cdrom_msf
msf
;
if
(
copy_from_user
(
&
ti
,
(
void
*
)
arg
,
sizeof
ti
))
if
(
copy_from_user
(
&
ti
,
arg
,
sizeof
ti
))
return
-
EFAULT
;
if
(
ti
.
cdti_trk0
<
disk_info
.
first
...
...
@@ -1505,23 +1505,23 @@ static int cdromplaytrkind(unsigned long arg)
}
static
int
cdromreadtochdr
(
unsigned
long
arg
)
static
int
cdromreadtochdr
(
void
__user
*
arg
)
{
struct
cdrom_tochdr
tochdr
;
tochdr
.
cdth_trk0
=
disk_info
.
first
;
tochdr
.
cdth_trk1
=
disk_info
.
last
;
return
copy_to_user
(
(
void
*
)
arg
,
&
tochdr
,
sizeof
tochdr
)
?
-
EFAULT
:
0
;
return
copy_to_user
(
arg
,
&
tochdr
,
sizeof
tochdr
)
?
-
EFAULT
:
0
;
}
static
int
cdromreadtocentry
(
unsigned
long
arg
)
static
int
cdromreadtocentry
(
void
__user
*
arg
)
{
struct
cdrom_tocentry
entry
;
struct
cdrom_subchnl
*
tocptr
;
if
(
copy_from_user
(
&
entry
,
(
void
*
)
arg
,
sizeof
entry
))
if
(
copy_from_user
(
&
entry
,
arg
,
sizeof
entry
))
return
-
EFAULT
;
if
(
entry
.
cdte_track
==
CDROM_LEADOUT
)
...
...
@@ -1544,17 +1544,17 @@ static int cdromreadtocentry(unsigned long arg)
else
if
(
entry
.
cdte_format
!=
CDROM_MSF
)
return
-
EINVAL
;
return
copy_to_user
(
(
void
*
)
arg
,
&
entry
,
sizeof
entry
)
?
-
EFAULT
:
0
;
return
copy_to_user
(
arg
,
&
entry
,
sizeof
entry
)
?
-
EFAULT
:
0
;
}
static
int
cdromvolctrl
(
unsigned
long
arg
)
static
int
cdromvolctrl
(
void
__user
*
arg
)
{
int
status
;
struct
cdrom_volctrl
volctrl
;
struct
cdrom_msf
msf
;
if
(
copy_from_user
(
&
volctrl
,
(
char
*
)
arg
,
sizeof
volctrl
))
if
(
copy_from_user
(
&
volctrl
,
arg
,
sizeof
volctrl
))
return
-
EFAULT
;
msf
.
cdmsf_min0
=
0x10
;
...
...
@@ -1573,12 +1573,12 @@ static int cdromvolctrl(unsigned long arg)
}
static
int
cdromsubchnl
(
unsigned
long
arg
)
static
int
cdromsubchnl
(
void
__user
*
arg
)
{
int
status
;
struct
cdrom_subchnl
subchnl
;
if
(
copy_from_user
(
&
subchnl
,
(
void
*
)
arg
,
sizeof
subchnl
))
if
(
copy_from_user
(
&
subchnl
,
arg
,
sizeof
subchnl
))
return
-
EFAULT
;
if
(
subchnl
.
cdsc_format
!=
CDROM_LBA
...
...
@@ -1591,7 +1591,7 @@ static int cdromsubchnl(unsigned long arg)
return
-
EIO
;
}
if
(
copy_to_user
(
(
void
*
)
arg
,
&
subchnl
,
sizeof
subchnl
))
if
(
copy_to_user
(
arg
,
&
subchnl
,
sizeof
subchnl
))
return
-
EFAULT
;
return
0
;
}
...
...
@@ -1600,12 +1600,12 @@ static int cdromsubchnl(unsigned long arg)
static
struct
gendisk
*
optcd_disk
;
static
int
cdromread
(
unsigned
long
arg
,
int
blocksize
,
int
cmd
)
static
int
cdromread
(
void
__user
*
arg
,
int
blocksize
,
int
cmd
)
{
int
status
;
struct
cdrom_msf
msf
;
if
(
copy_from_user
(
&
msf
,
(
void
*
)
arg
,
sizeof
msf
))
if
(
copy_from_user
(
&
msf
,
arg
,
sizeof
msf
))
return
-
EFAULT
;
bin2bcd
(
&
msf
);
...
...
@@ -1621,19 +1621,19 @@ static int cdromread(unsigned long arg, int blocksize, int cmd)
fetch_data
(
optcd_disk
->
private_data
,
blocksize
);
if
(
copy_to_user
(
(
void
*
)
arg
,
optcd_disk
->
private_data
,
blocksize
))
if
(
copy_to_user
(
arg
,
optcd_disk
->
private_data
,
blocksize
))
return
-
EFAULT
;
return
0
;
}
static
int
cdromseek
(
unsigned
long
arg
)
static
int
cdromseek
(
void
__user
*
arg
)
{
int
status
;
struct
cdrom_msf
msf
;
if
(
copy_from_user
(
&
msf
,
(
void
*
)
arg
,
sizeof
msf
))
if
(
copy_from_user
(
&
msf
,
arg
,
sizeof
msf
))
return
-
EFAULT
;
bin2bcd
(
&
msf
);
...
...
@@ -1648,11 +1648,11 @@ static int cdromseek(unsigned long arg)
#ifdef MULTISESSION
static
int
cdrommultisession
(
unsigned
long
arg
)
static
int
cdrommultisession
(
void
__user
*
arg
)
{
struct
cdrom_multisession
ms
;
if
(
copy_from_user
(
&
ms
,
(
void
*
)
arg
,
sizeof
ms
))
if
(
copy_from_user
(
&
ms
,
arg
,
sizeof
ms
))
return
-
EFAULT
;
ms
.
addr
.
msf
.
minute
=
disk_info
.
last_session
.
minute
;
...
...
@@ -1667,7 +1667,7 @@ static int cdrommultisession(unsigned long arg)
ms
.
xa_flag
=
disk_info
.
xa
;
if
(
copy_to_user
(
(
void
*
)
arg
,
&
ms
,
sizeof
(
struct
cdrom_multisession
)))
if
(
copy_to_user
(
arg
,
&
ms
,
sizeof
(
struct
cdrom_multisession
)))
return
-
EFAULT
;
#if DEBUG_MULTIS
...
...
@@ -1717,6 +1717,7 @@ static int opt_ioctl(struct inode *ip, struct file *fp,
unsigned
int
cmd
,
unsigned
long
arg
)
{
int
status
,
err
,
retval
=
0
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
DEBUG
((
DEBUG_VFS
,
"starting opt_ioctl"
));
...
...
@@ -1767,10 +1768,10 @@ static int opt_ioctl(struct inode *ip, struct file *fp,
switch
(
cmd
)
{
case
CDROMPAUSE
:
retval
=
cdrompause
();
break
;
case
CDROMRESUME
:
retval
=
cdromresume
();
break
;
case
CDROMPLAYMSF
:
retval
=
cdromplaymsf
(
arg
);
break
;
case
CDROMPLAYTRKIND
:
retval
=
cdromplaytrkind
(
arg
);
break
;
case
CDROMREADTOCHDR
:
retval
=
cdromreadtochdr
(
arg
);
break
;
case
CDROMREADTOCENTRY
:
retval
=
cdromreadtocentry
(
arg
);
break
;
case
CDROMPLAYMSF
:
retval
=
cdromplaymsf
(
arg
p
);
break
;
case
CDROMPLAYTRKIND
:
retval
=
cdromplaytrkind
(
arg
p
);
break
;
case
CDROMREADTOCHDR
:
retval
=
cdromreadtochdr
(
arg
p
);
break
;
case
CDROMREADTOCENTRY
:
retval
=
cdromreadtocentry
(
arg
p
);
break
;
case
CDROMSTOP
:
err
=
exec_cmd
(
COMSTOP
);
if
(
err
<
0
)
{
...
...
@@ -1799,8 +1800,8 @@ static int opt_ioctl(struct inode *ip, struct file *fp,
}
break
;
case
CDROMVOLCTRL
:
retval
=
cdromvolctrl
(
arg
);
break
;
case
CDROMSUBCHNL
:
retval
=
cdromsubchnl
(
arg
);
break
;
case
CDROMVOLCTRL
:
retval
=
cdromvolctrl
(
arg
p
);
break
;
case
CDROMSUBCHNL
:
retval
=
cdromsubchnl
(
arg
p
);
break
;
/* The drive detects the mode and automatically delivers the
correct 2048 bytes, so we don't need these IOCTLs */
...
...
@@ -1814,7 +1815,7 @@ static int opt_ioctl(struct inode *ip, struct file *fp,
break
;
#ifdef MULTISESSION
case
CDROMMULTISESSION
:
retval
=
cdrommultisession
(
arg
);
break
;
case
CDROMMULTISESSION
:
retval
=
cdrommultisession
(
arg
p
);
break
;
#endif
case
CDROM_GET_MCN
:
retval
=
-
EINVAL
;
break
;
/* not implemented */
...
...
@@ -1822,16 +1823,16 @@ static int opt_ioctl(struct inode *ip, struct file *fp,
case
CDROMREADRAW
:
/* this drive delivers 2340 bytes in raw mode */
retval
=
cdromread
(
arg
,
CD_FRAMESIZE_RAW1
,
COMREADRAW
);
retval
=
cdromread
(
arg
p
,
CD_FRAMESIZE_RAW1
,
COMREADRAW
);
break
;
case
CDROMREADCOOKED
:
retval
=
cdromread
(
arg
,
CD_FRAMESIZE
,
COMREAD
);
retval
=
cdromread
(
arg
p
,
CD_FRAMESIZE
,
COMREAD
);
break
;
case
CDROMREADALL
:
retval
=
cdromread
(
arg
,
CD_FRAMESIZE_RAWER
,
COMREADALL
);
retval
=
cdromread
(
arg
p
,
CD_FRAMESIZE_RAWER
,
COMREADALL
);
break
;
case
CDROMSEEK
:
retval
=
cdromseek
(
arg
);
break
;
case
CDROMSEEK
:
retval
=
cdromseek
(
arg
p
);
break
;
case
CDROMPLAYBLK
:
retval
=
-
EINVAL
;
break
;
/* not implemented */
case
CDROMCLOSETRAY
:
break
;
/* The action was taken earlier */
default:
retval
=
-
EINVAL
;
...
...
drivers/cdrom/sjcd.c
View file @
bd12c17c
...
...
@@ -716,13 +716,11 @@ static int sjcd_tray_open(void)
static
int
sjcd_ioctl
(
struct
inode
*
ip
,
struct
file
*
fp
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
argp
=
(
void
__user
*
)
arg
;
#if defined( SJCD_TRACE )
printk
(
"SJCD:ioctl
\n
"
);
#endif
if
(
ip
==
NULL
)
return
(
-
EINVAL
);
sjcd_get_status
();
if
(
!
sjcd_status_valid
)
return
(
-
EIO
);
...
...
@@ -795,7 +793,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
#if defined( SJCD_TRACE )
printk
(
"SJCD: ioctl: playtrkind
\n
"
);
#endif
if
(
!
copy_from_user
(
&
ti
,
(
void
*
)
arg
,
sizeof
(
ti
)))
{
if
(
!
copy_from_user
(
&
ti
,
argp
,
sizeof
(
ti
)))
{
s
=
0
;
if
(
ti
.
cdti_trk0
<
sjcd_first_track_no
)
return
(
-
EINVAL
);
...
...
@@ -833,7 +831,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
printk
(
"SJCD: ioctl: playmsf
\n
"
);
#endif
if
((
s
=
verify_area
(
VERIFY_READ
,
(
void
*
)
arg
,
verify_area
(
VERIFY_READ
,
argp
,
sizeof
(
sjcd_msf
)))
==
0
)
{
if
(
sjcd_audio_status
==
CDROM_AUDIO_PLAY
)
{
sjcd_send_cmd
(
SCMD_PAUSE
);
...
...
@@ -842,7 +840,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
CDROM_AUDIO_NO_STATUS
;
}
if
(
copy_from_user
(
&
sjcd_msf
,
(
void
*
)
arg
,
if
(
copy_from_user
(
&
sjcd_msf
,
argp
,
sizeof
(
sjcd_msf
)))
return
(
-
EFAULT
);
...
...
@@ -877,7 +875,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
#endif
toc_header
.
cdth_trk0
=
sjcd_first_track_no
;
toc_header
.
cdth_trk1
=
sjcd_last_track_no
;
if
(
copy_to_user
(
(
void
*
)
arg
,
&
toc_header
,
if
(
copy_to_user
(
argp
,
&
toc_header
,
sizeof
(
toc_header
)))
return
-
EFAULT
;
return
0
;
...
...
@@ -890,11 +888,11 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
printk
(
"SJCD: ioctl: readtocentry
\n
"
);
#endif
if
((
s
=
verify_area
(
VERIFY_WRITE
,
(
void
*
)
arg
,
verify_area
(
VERIFY_WRITE
,
argp
,
sizeof
(
toc_entry
)))
==
0
)
{
struct
sjcd_hw_disk_info
*
tp
;
if
(
copy_from_user
(
&
toc_entry
,
(
void
*
)
arg
,
if
(
copy_from_user
(
&
toc_entry
,
argp
,
sizeof
(
toc_entry
)))
return
(
-
EFAULT
);
if
(
toc_entry
.
cdte_track
==
CDROM_LEADOUT
)
...
...
@@ -931,7 +929,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
default:
return
(
-
EINVAL
);
}
if
(
copy_to_user
(
(
void
*
)
arg
,
&
toc_entry
,
if
(
copy_to_user
(
argp
,
&
toc_entry
,
sizeof
(
toc_entry
)))
s
=
-
EFAULT
;
}
...
...
@@ -945,11 +943,11 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
printk
(
"SJCD: ioctl: subchnl
\n
"
);
#endif
if
((
s
=
verify_area
(
VERIFY_WRITE
,
(
void
*
)
arg
,
verify_area
(
VERIFY_WRITE
,
argp
,
sizeof
(
subchnl
)))
==
0
)
{
struct
sjcd_hw_qinfo
q_info
;
if
(
copy_from_user
(
&
subchnl
,
(
void
*
)
arg
,
if
(
copy_from_user
(
&
subchnl
,
argp
,
sizeof
(
subchnl
)))
return
(
-
EFAULT
);
...
...
@@ -990,7 +988,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
default:
return
(
-
EINVAL
);
}
if
(
copy_to_user
(
(
void
*
)
arg
,
&
subchnl
,
if
(
copy_to_user
(
argp
,
&
subchnl
,
sizeof
(
subchnl
)))
s
=
-
EFAULT
;
}
...
...
@@ -1004,11 +1002,11 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
printk
(
"SJCD: ioctl: volctrl
\n
"
);
#endif
if
((
s
=
verify_area
(
VERIFY_READ
,
(
void
*
)
arg
,
verify_area
(
VERIFY_READ
,
argp
,
sizeof
(
vol_ctrl
)))
==
0
)
{
unsigned
char
dummy
[
4
];
if
(
copy_from_user
(
&
vol_ctrl
,
(
void
*
)
arg
,
if
(
copy_from_user
(
&
vol_ctrl
,
argp
,
sizeof
(
vol_ctrl
)))
return
(
-
EFAULT
);
sjcd_send_4_cmd
(
SCMD_SET_VOLUME
,
...
...
@@ -1038,8 +1036,7 @@ static int sjcd_ioctl(struct inode *ip, struct file *fp,
#if defined( SJCD_TRACE )
printk
(
"SJCD: ioctl: statistic
\n
"
);
#endif
if
(
copy_to_user
((
void
*
)
arg
,
&
statistic
,
sizeof
(
statistic
)))
if
(
copy_to_user
(
argp
,
&
statistic
,
sizeof
(
statistic
)))
return
-
EFAULT
;
return
0
;
}
...
...
drivers/cdrom/sonycd535.c
View file @
bd12c17c
...
...
@@ -997,7 +997,7 @@ read_subcode(void)
* (not BCD), so all the conversions are done.
*/
static
int
sony_get_subchnl_info
(
long
arg
)
sony_get_subchnl_info
(
void
__user
*
arg
)
{
struct
cdrom_subchnl
schi
;
...
...
@@ -1009,7 +1009,7 @@ sony_get_subchnl_info(long arg)
if
(
!
sony_toc_read
)
{
return
-
EIO
;
}
if
(
copy_from_user
(
&
schi
,
(
char
*
)
arg
,
sizeof
schi
))
if
(
copy_from_user
(
&
schi
,
arg
,
sizeof
schi
))
return
-
EFAULT
;
switch
(
sony_audio_status
)
{
...
...
@@ -1025,7 +1025,7 @@ sony_get_subchnl_info(long arg)
case
CDROM_AUDIO_NO_STATUS
:
schi
.
cdsc_audiostatus
=
sony_audio_status
;
if
(
copy_to_user
(
(
char
*
)
arg
,
&
schi
,
sizeof
schi
))
if
(
copy_to_user
(
arg
,
&
schi
,
sizeof
schi
))
return
-
EFAULT
;
return
0
;
break
;
...
...
@@ -1053,7 +1053,7 @@ sony_get_subchnl_info(long arg)
schi
.
cdsc_absaddr
.
lba
=
msf_to_log
(
last_sony_subcode
->
abs_msf
);
schi
.
cdsc_reladdr
.
lba
=
msf_to_log
(
last_sony_subcode
->
rel_msf
);
}
return
copy_to_user
(
(
char
*
)
arg
,
&
schi
,
sizeof
schi
)
?
-
EFAULT
:
0
;
return
copy_to_user
(
arg
,
&
schi
,
sizeof
schi
)
?
-
EFAULT
:
0
;
}
...
...
@@ -1070,6 +1070,7 @@ cdu_ioctl(struct inode *inode,
Byte
cmd_buff
[
10
],
params
[
10
];
int
i
;
int
dsc_status
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
if
(
check_drive_status
()
!=
0
)
return
-
EIO
;
...
...
@@ -1152,7 +1153,7 @@ cdu_ioctl(struct inode *inode,
break
;
case
CDROMPLAYMSF
:
/* Play starting at the given MSF address. */
if
(
copy_from_user
(
params
,
(
void
*
)
arg
,
6
))
if
(
copy_from_user
(
params
,
argp
,
6
))
return
-
EFAULT
;
spin_up_drive
(
status
);
set_drive_mode
(
SONY535_AUDIO_DRIVE_MODE
,
status
);
...
...
@@ -1184,13 +1185,12 @@ cdu_ioctl(struct inode *inode,
case
CDROMREADTOCHDR
:
/* Read the table of contents header */
{
struct
cdrom_tochdr
*
hdr
;
struct
cdrom_tochdr
__user
*
hdr
=
argp
;
struct
cdrom_tochdr
loc_hdr
;
sony_get_toc
();
if
(
!
sony_toc_read
)
return
-
EIO
;
hdr
=
(
struct
cdrom_tochdr
*
)
arg
;
loc_hdr
.
cdth_trk0
=
bcd_to_int
(
sony_toc
->
first_track_num
);
loc_hdr
.
cdth_trk1
=
bcd_to_int
(
sony_toc
->
last_track_num
);
if
(
copy_to_user
(
hdr
,
&
loc_hdr
,
sizeof
*
hdr
))
...
...
@@ -1201,7 +1201,7 @@ cdu_ioctl(struct inode *inode,
case
CDROMREADTOCENTRY
:
/* Read a given table of contents entry */
{
struct
cdrom_tocentry
*
entry
;
struct
cdrom_tocentry
__user
*
entry
=
argp
;
struct
cdrom_tocentry
loc_entry
;
int
track_idx
;
Byte
*
msf_val
=
NULL
;
...
...
@@ -1210,7 +1210,6 @@ cdu_ioctl(struct inode *inode,
if
(
!
sony_toc_read
)
{
return
-
EIO
;
}
entry
=
(
struct
cdrom_tocentry
*
)
arg
;
if
(
copy_from_user
(
&
loc_entry
,
entry
,
sizeof
loc_entry
))
return
-
EFAULT
;
...
...
@@ -1252,7 +1251,7 @@ cdu_ioctl(struct inode *inode,
if
(
!
sony_toc_read
)
return
-
EIO
;
if
(
copy_from_user
(
&
ti
,
(
char
*
)
arg
,
sizeof
ti
))
if
(
copy_from_user
(
&
ti
,
argp
,
sizeof
ti
))
return
-
EFAULT
;
if
((
ti
.
cdti_trk0
<
sony_toc
->
first_track_num
)
||
(
sony_toc
->
last_track_num
<
ti
.
cdti_trk0
)
...
...
@@ -1314,14 +1313,13 @@ cdu_ioctl(struct inode *inode,
}
case
CDROMSUBCHNL
:
/* Get subchannel info */
return
sony_get_subchnl_info
(
arg
);
return
sony_get_subchnl_info
(
arg
p
);
case
CDROMVOLCTRL
:
/* Volume control. What volume does this change, anyway? */
{
struct
cdrom_volctrl
volctrl
;
if
(
copy_from_user
(
&
volctrl
,
(
char
*
)
arg
,
sizeof
volctrl
))
if
(
copy_from_user
(
&
volctrl
,
argp
,
sizeof
volctrl
))
return
-
EFAULT
;
cmd_buff
[
0
]
=
SONY535_SET_VOLUME
;
cmd_buff
[
1
]
=
volctrl
.
channel0
;
...
...
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