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
9464d6ad
Commit
9464d6ad
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: trivial part of drivers/ide __user annotation
parent
afc11cbc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
25 deletions
+28
-25
drivers/ide/ide-cd.c
drivers/ide/ide-cd.c
+2
-2
drivers/ide/ide-taskfile.c
drivers/ide/ide-taskfile.c
+12
-10
drivers/ide/ide.c
drivers/ide/ide.c
+14
-13
No files found.
drivers/ide/ide-cd.c
View file @
9464d6ad
...
...
@@ -2535,7 +2535,7 @@ int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi,
case
CDROMSETSPINDOWN
:
{
char
spindown
;
if
(
copy_from_user
(
&
spindown
,
(
void
*
)
arg
,
sizeof
(
char
)))
if
(
copy_from_user
(
&
spindown
,
(
void
__user
*
)
arg
,
sizeof
(
char
)))
return
-
EFAULT
;
if
((
stat
=
cdrom_mode_sense
(
cdi
,
&
cgc
,
GPMODE_CDROM_PAGE
,
0
)))
...
...
@@ -2554,7 +2554,7 @@ int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi,
spindown
=
buffer
[
11
]
&
0x0f
;
if
(
copy_to_user
((
void
*
)
arg
,
&
spindown
,
sizeof
(
char
)))
if
(
copy_to_user
((
void
__user
*
)
arg
,
&
spindown
,
sizeof
(
char
)))
return
-
EFAULT
;
return
0
;
...
...
drivers/ide/ide-taskfile.c
View file @
9464d6ad
...
...
@@ -1052,13 +1052,14 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
int
taskin
=
0
;
int
taskout
=
0
;
u8
io_32bit
=
drive
->
io_32bit
;
char
__user
*
buf
=
(
char
__user
*
)
arg
;
// printk("IDE Taskfile ...\n");
req_task
=
kmalloc
(
tasksize
,
GFP_KERNEL
);
if
(
req_task
==
NULL
)
return
-
ENOMEM
;
memset
(
req_task
,
0
,
tasksize
);
if
(
copy_from_user
(
req_task
,
(
void
*
)
arg
,
tasksize
))
{
if
(
copy_from_user
(
req_task
,
buf
,
tasksize
))
{
kfree
(
req_task
);
return
-
EFAULT
;
}
...
...
@@ -1074,7 +1075,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
goto
abort
;
}
memset
(
outbuf
,
0
,
taskout
);
if
(
copy_from_user
(
outbuf
,
(
void
*
)
arg
+
outtotal
,
taskout
))
{
if
(
copy_from_user
(
outbuf
,
buf
+
outtotal
,
taskout
))
{
err
=
-
EFAULT
;
goto
abort
;
}
...
...
@@ -1088,7 +1089,7 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
goto
abort
;
}
memset
(
inbuf
,
0
,
taskin
);
if
(
copy_from_user
(
inbuf
,
(
void
*
)
arg
+
intotal
,
taskin
))
{
if
(
copy_from_user
(
inbuf
,
buf
+
intotal
,
taskin
))
{
err
=
-
EFAULT
;
goto
abort
;
}
...
...
@@ -1196,20 +1197,20 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
req_task
->
in_flags
=
args
.
tf_in_flags
;
req_task
->
out_flags
=
args
.
tf_out_flags
;
if
(
copy_to_user
(
(
void
*
)
arg
,
req_task
,
tasksize
))
{
if
(
copy_to_user
(
buf
,
req_task
,
tasksize
))
{
err
=
-
EFAULT
;
goto
abort
;
}
if
(
taskout
)
{
int
outtotal
=
tasksize
;
if
(
copy_to_user
(
(
void
*
)
arg
+
outtotal
,
outbuf
,
taskout
))
{
if
(
copy_to_user
(
buf
+
outtotal
,
outbuf
,
taskout
))
{
err
=
-
EFAULT
;
goto
abort
;
}
}
if
(
taskin
)
{
int
intotal
=
tasksize
+
taskout
;
if
(
copy_to_user
(
(
void
*
)
arg
+
intotal
,
inbuf
,
taskin
))
{
if
(
copy_to_user
(
buf
+
intotal
,
inbuf
,
taskin
))
{
err
=
-
EFAULT
;
goto
abort
;
}
...
...
@@ -1266,7 +1267,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
return
ide_do_drive_cmd
(
drive
,
&
rq
,
ide_wait
);
}
if
(
copy_from_user
(
args
,
(
void
*
)
arg
,
4
))
if
(
copy_from_user
(
args
,
(
void
__user
*
)
arg
,
4
))
return
-
EFAULT
;
memset
(
&
tfargs
,
0
,
sizeof
(
ide_task_t
));
...
...
@@ -1299,7 +1300,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
ide_driveid_update
(
drive
);
}
abort:
if
(
copy_to_user
((
void
*
)
arg
,
argbuf
,
argsize
))
if
(
copy_to_user
((
void
__user
*
)
arg
,
argbuf
,
argsize
))
err
=
-
EFAULT
;
if
(
argsize
>
4
)
kfree
(
argbuf
);
...
...
@@ -1325,14 +1326,15 @@ EXPORT_SYMBOL(ide_wait_cmd_task);
*/
int
ide_task_ioctl
(
ide_drive_t
*
drive
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
void
__user
*
p
=
(
void
__user
*
)
arg
;
int
err
=
0
;
u8
args
[
7
],
*
argbuf
=
args
;
int
argsize
=
7
;
if
(
copy_from_user
(
args
,
(
void
*
)
arg
,
7
))
if
(
copy_from_user
(
args
,
p
,
7
))
return
-
EFAULT
;
err
=
ide_wait_cmd_task
(
drive
,
argbuf
);
if
(
copy_to_user
(
(
void
*
)
arg
,
argbuf
,
argsize
))
if
(
copy_to_user
(
p
,
argbuf
,
argsize
))
err
=
-
EFAULT
;
return
err
;
}
...
...
drivers/ide/ide.c
View file @
9464d6ad
...
...
@@ -1493,13 +1493,14 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
ide_drive_t
*
drive
=
bdev
->
bd_disk
->
private_data
;
ide_settings_t
*
setting
;
int
err
=
0
;
void
__user
*
p
=
(
void
__user
*
)
arg
;
down
(
&
ide_setting_sem
);
if
((
setting
=
ide_find_setting_by_ioctl
(
drive
,
cmd
))
!=
NULL
)
{
if
(
cmd
==
setting
->
read_ioctl
)
{
err
=
ide_read_setting
(
drive
,
setting
);
up
(
&
ide_setting_sem
);
return
err
>=
0
?
put_user
(
err
,
(
long
*
)
arg
)
:
err
;
return
err
>=
0
?
put_user
(
err
,
(
long
__user
*
)
arg
)
:
err
;
}
else
{
if
(
bdev
!=
bdev
->
bd_contains
)
err
=
-
EINVAL
;
...
...
@@ -1514,14 +1515,14 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
switch
(
cmd
)
{
case
HDIO_GETGEO
:
{
struct
hd_geometry
*
loc
=
(
struct
hd_geometry
*
)
arg
;
u16
bios_cyl
=
drive
->
bios_cyl
;
/* truncate */
if
(
!
loc
||
(
drive
->
media
!=
ide_disk
&&
drive
->
media
!=
ide_floppy
))
return
-
EINVAL
;
if
(
put_user
(
drive
->
bios_head
,
(
u8
*
)
&
loc
->
heads
))
return
-
EFAULT
;
if
(
put_user
(
drive
->
bios_sect
,
(
u8
*
)
&
loc
->
sectors
))
return
-
EFAULT
;
if
(
put_user
(
bios_cyl
,
(
u16
*
)
&
loc
->
cylinders
))
return
-
EFAULT
;
if
(
put_user
((
unsigned
)
get_start_sect
(
bdev
),
(
unsigned
long
*
)
&
loc
->
start
))
return
-
EFAULT
;
struct
hd_geometry
geom
;
if
(
!
p
||
(
drive
->
media
!=
ide_disk
&&
drive
->
media
!=
ide_floppy
))
return
-
EINVAL
;
geom
.
heads
=
drive
->
bios_head
;
geom
.
sectors
=
drive
->
bios_sect
;
geom
.
cylinders
=
(
u16
)
drive
->
bios_cyl
;
/* truncate */
geom
.
start
=
get_start_sect
(
bdev
)
;
if
(
copy_to_user
(
p
,
&
geom
,
sizeof
(
struct
hd_geometry
)))
return
-
EFAULT
;
return
0
;
}
...
...
@@ -1531,7 +1532,7 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
return
-
EINVAL
;
if
(
drive
->
id_read
==
0
)
return
-
ENOMSG
;
if
(
copy_to_user
(
(
char
*
)
arg
,
(
char
*
)
drive
->
id
,
(
cmd
==
HDIO_GET_IDENTITY
)
?
sizeof
(
*
drive
->
id
)
:
142
))
if
(
copy_to_user
(
p
,
drive
->
id
,
(
cmd
==
HDIO_GET_IDENTITY
)
?
sizeof
(
*
drive
->
id
)
:
142
))
return
-
EFAULT
;
return
0
;
...
...
@@ -1541,7 +1542,7 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
drive
->
nice0
<<
IDE_NICE_0
|
drive
->
nice1
<<
IDE_NICE_1
|
drive
->
nice2
<<
IDE_NICE_2
,
(
long
*
)
arg
);
(
long
__user
*
)
arg
);
#ifdef CONFIG_IDE_TASK_IOCTL
case
HDIO_DRIVE_TASKFILE
:
...
...
@@ -1570,7 +1571,7 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
hw_regs_t
hw
;
int
args
[
3
];
if
(
!
capable
(
CAP_SYS_RAWIO
))
return
-
EACCES
;
if
(
copy_from_user
(
args
,
(
void
*
)
arg
,
3
*
sizeof
(
int
)))
if
(
copy_from_user
(
args
,
p
,
3
*
sizeof
(
int
)))
return
-
EFAULT
;
memset
(
&
hw
,
0
,
sizeof
(
hw
));
ide_init_hwif_ports
(
&
hw
,
(
unsigned
long
)
args
[
0
],
...
...
@@ -1643,7 +1644,7 @@ int generic_ide_ioctl(struct block_device *bdev, unsigned int cmd,
case
HDIO_GET_BUSSTATE
:
if
(
!
capable
(
CAP_SYS_ADMIN
))
return
-
EACCES
;
if
(
put_user
(
HWIF
(
drive
)
->
bus_state
,
(
long
*
)
arg
))
if
(
put_user
(
HWIF
(
drive
)
->
bus_state
,
(
long
__user
*
)
arg
))
return
-
EFAULT
;
return
0
;
...
...
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