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
78d759d8
Commit
78d759d8
authored
Jun 21, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Jun 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] sparse: ncpfs/ioctl.c annotation
parent
0ee7d70e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
48 deletions
+40
-48
fs/ncpfs/ioctl.c
fs/ncpfs/ioctl.c
+37
-45
include/linux/ncp_fs.h
include/linux/ncp_fs.h
+3
-3
No files found.
fs/ncpfs/ioctl.c
View file @
78d759d8
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
#define NCP_PACKET_SIZE_INTERNAL 65536
#define NCP_PACKET_SIZE_INTERNAL 65536
static
int
static
int
ncp_get_fs_info
(
struct
ncp_server
*
server
,
struct
inode
*
inode
,
struct
ncp_fs_info
*
arg
)
ncp_get_fs_info
(
struct
ncp_server
*
server
,
struct
inode
*
inode
,
struct
ncp_fs_info
__user
*
arg
)
{
{
struct
ncp_fs_info
info
;
struct
ncp_fs_info
info
;
...
@@ -58,7 +58,7 @@ ncp_get_fs_info(struct ncp_server* server, struct inode* inode, struct ncp_fs_in
...
@@ -58,7 +58,7 @@ ncp_get_fs_info(struct ncp_server* server, struct inode* inode, struct ncp_fs_in
}
}
static
int
static
int
ncp_get_fs_info_v2
(
struct
ncp_server
*
server
,
struct
inode
*
inode
,
struct
ncp_fs_info_v2
*
arg
)
ncp_get_fs_info_v2
(
struct
ncp_server
*
server
,
struct
inode
*
inode
,
struct
ncp_fs_info_v2
__user
*
arg
)
{
{
struct
ncp_fs_info_v2
info2
;
struct
ncp_fs_info_v2
info2
;
...
@@ -90,7 +90,7 @@ ncp_get_fs_info_v2(struct ncp_server* server, struct inode* inode, struct ncp_fs
...
@@ -90,7 +90,7 @@ ncp_get_fs_info_v2(struct ncp_server* server, struct inode* inode, struct ncp_fs
* Thanks Petr Vandrovec for idea and many hints.
* Thanks Petr Vandrovec for idea and many hints.
*/
*/
static
int
static
int
ncp_set_charsets
(
struct
ncp_server
*
server
,
struct
ncp_nls_ioctl
*
arg
)
ncp_set_charsets
(
struct
ncp_server
*
server
,
struct
ncp_nls_ioctl
__user
*
arg
)
{
{
struct
ncp_nls_ioctl
user
;
struct
ncp_nls_ioctl
user
;
struct
nls_table
*
codepage
;
struct
nls_table
*
codepage
;
...
@@ -148,7 +148,7 @@ ncp_set_charsets(struct ncp_server* server, struct ncp_nls_ioctl* arg)
...
@@ -148,7 +148,7 @@ ncp_set_charsets(struct ncp_server* server, struct ncp_nls_ioctl* arg)
}
}
static
int
static
int
ncp_get_charsets
(
struct
ncp_server
*
server
,
struct
ncp_nls_ioctl
*
arg
)
ncp_get_charsets
(
struct
ncp_server
*
server
,
struct
ncp_nls_ioctl
__user
*
arg
)
{
{
struct
ncp_nls_ioctl
user
;
struct
ncp_nls_ioctl
user
;
int
len
;
int
len
;
...
@@ -185,6 +185,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -185,6 +185,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
int
result
;
int
result
;
struct
ncp_ioctl_request
request
;
struct
ncp_ioctl_request
request
;
char
*
bouncebuffer
;
char
*
bouncebuffer
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
NCP_IOC_NCPREQUEST
:
case
NCP_IOC_NCPREQUEST
:
...
@@ -193,8 +194,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -193,8 +194,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
&&
(
current
->
uid
!=
server
->
m
.
mounted_uid
))
{
&&
(
current
->
uid
!=
server
->
m
.
mounted_uid
))
{
return
-
EACCES
;
return
-
EACCES
;
}
}
if
(
copy_from_user
(
&
request
,
(
struct
ncp_ioctl_request
*
)
arg
,
if
(
copy_from_user
(
&
request
,
argp
,
sizeof
(
request
)))
sizeof
(
request
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
((
request
.
function
>
255
)
if
((
request
.
function
>
255
)
...
@@ -245,10 +245,10 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -245,10 +245,10 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return
ncp_conn_logged_in
(
inode
->
i_sb
);
return
ncp_conn_logged_in
(
inode
->
i_sb
);
case
NCP_IOC_GET_FS_INFO
:
case
NCP_IOC_GET_FS_INFO
:
return
ncp_get_fs_info
(
server
,
inode
,
(
struct
ncp_fs_info
*
)
arg
);
return
ncp_get_fs_info
(
server
,
inode
,
argp
);
case
NCP_IOC_GET_FS_INFO_V2
:
case
NCP_IOC_GET_FS_INFO_V2
:
return
ncp_get_fs_info_v2
(
server
,
inode
,
(
struct
ncp_fs_info_v2
*
)
arg
);
return
ncp_get_fs_info_v2
(
server
,
inode
,
argp
);
case
NCP_IOC_GETMOUNTUID2
:
case
NCP_IOC_GETMOUNTUID2
:
{
{
...
@@ -259,7 +259,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -259,7 +259,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
{
{
return
-
EACCES
;
return
-
EACCES
;
}
}
if
(
put_user
(
tmp
,
(
unsigned
long
*
)
arg
))
if
(
put_user
(
tmp
,
(
unsigned
long
__user
*
)
argp
))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -292,9 +292,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -292,9 +292,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
sr
.
namespace
=
0
;
sr
.
namespace
=
0
;
sr
.
dirEntNum
=
0
;
sr
.
dirEntNum
=
0
;
}
}
if
(
copy_to_user
((
struct
ncp_setroot_ioctl
*
)
arg
,
if
(
copy_to_user
(
argp
,
&
sr
,
sizeof
(
sr
)))
&
sr
,
return
-
EFAULT
;
sizeof
(
sr
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
NCP_IOC_SETROOT
:
case
NCP_IOC_SETROOT
:
...
@@ -308,9 +307,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -308,9 +307,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return
-
EACCES
;
return
-
EACCES
;
}
}
if
(
server
->
root_setuped
)
return
-
EBUSY
;
if
(
server
->
root_setuped
)
return
-
EBUSY
;
if
(
copy_from_user
(
&
sr
,
if
(
copy_from_user
(
&
sr
,
argp
,
sizeof
(
sr
)))
(
struct
ncp_setroot_ioctl
*
)
arg
,
return
-
EFAULT
;
sizeof
(
sr
)))
return
-
EFAULT
;
if
(
sr
.
volNumber
<
0
)
{
if
(
sr
.
volNumber
<
0
)
{
server
->
m
.
mounted_vol
[
0
]
=
0
;
server
->
m
.
mounted_vol
[
0
]
=
0
;
vnum
=
NCP_NUMBER_OF_VOLUMES
;
vnum
=
NCP_NUMBER_OF_VOLUMES
;
...
@@ -348,13 +346,13 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -348,13 +346,13 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
{
{
return
-
EACCES
;
return
-
EACCES
;
}
}
if
(
arg
)
{
if
(
arg
p
)
{
if
(
server
->
sign_wanted
)
if
(
server
->
sign_wanted
)
{
{
struct
ncp_sign_init
sign
;
struct
ncp_sign_init
sign
;
if
(
copy_from_user
(
&
sign
,
(
struct
ncp_sign_init
*
)
arg
,
if
(
copy_from_user
(
&
sign
,
argp
,
sizeof
(
sign
)))
sizeof
(
sign
)))
return
-
EFAULT
;
return
-
EFAULT
;
memcpy
(
server
->
sign_root
,
sign
.
sign_root
,
8
);
memcpy
(
server
->
sign_root
,
sign
.
sign_root
,
8
);
memcpy
(
server
->
sign_last
,
sign
.
sign_last
,
16
);
memcpy
(
server
->
sign_last
,
sign
.
sign_last
,
16
);
server
->
sign_active
=
1
;
server
->
sign_active
=
1
;
...
@@ -372,7 +370,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -372,7 +370,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return
-
EACCES
;
return
-
EACCES
;
}
}
if
(
put_user
(
server
->
sign_wanted
,
(
int
*
)
arg
))
if
(
put_user
(
server
->
sign_wanted
,
(
int
__user
*
)
argp
))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
case
NCP_IOC_SET_SIGN_WANTED
:
case
NCP_IOC_SET_SIGN_WANTED
:
...
@@ -385,7 +383,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -385,7 +383,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return
-
EACCES
;
return
-
EACCES
;
}
}
/* get only low 8 bits... */
/* get only low 8 bits... */
if
(
get_user
(
newstate
,
(
unsigned
char
*
)
arg
))
if
(
get_user
(
newstate
,
(
unsigned
char
__user
*
)
argp
))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
server
->
sign_active
)
{
if
(
server
->
sign_active
)
{
/* cannot turn signatures OFF when active */
/* cannot turn signatures OFF when active */
...
@@ -409,8 +407,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -409,8 +407,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
struct
ncp_lock_ioctl
rqdata
;
struct
ncp_lock_ioctl
rqdata
;
int
result
;
int
result
;
if
(
copy_from_user
(
&
rqdata
,
(
struct
ncp_lock_ioctl
*
)
arg
,
if
(
copy_from_user
(
&
rqdata
,
argp
,
sizeof
(
rqdata
)))
sizeof
(
rqdata
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
rqdata
.
origin
!=
0
)
if
(
rqdata
.
origin
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
/* check for cmd */
/* check for cmd */
...
@@ -480,9 +478,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -480,9 +478,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
struct
ncp_objectname_ioctl
user
;
struct
ncp_objectname_ioctl
user
;
size_t
outl
;
size_t
outl
;
if
(
copy_from_user
(
&
user
,
if
(
copy_from_user
(
&
user
,
argp
,
sizeof
(
user
)))
(
struct
ncp_objectname_ioctl
*
)
arg
,
return
-
EFAULT
;
sizeof
(
user
)))
return
-
EFAULT
;
user
.
auth_type
=
server
->
auth
.
auth_type
;
user
.
auth_type
=
server
->
auth
.
auth_type
;
outl
=
user
.
object_name_len
;
outl
=
user
.
object_name_len
;
user
.
object_name_len
=
server
->
auth
.
object_name_len
;
user
.
object_name_len
=
server
->
auth
.
object_name_len
;
...
@@ -493,9 +490,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -493,9 +490,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
server
->
auth
.
object_name
,
server
->
auth
.
object_name
,
outl
))
return
-
EFAULT
;
outl
))
return
-
EFAULT
;
}
}
if
(
copy_to_user
((
struct
ncp_objectname_ioctl
*
)
arg
,
if
(
copy_to_user
(
argp
,
&
user
,
sizeof
(
user
)))
&
user
,
return
-
EFAULT
;
sizeof
(
user
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
NCP_IOC_SETOBJECTNAME
:
case
NCP_IOC_SETOBJECTNAME
:
...
@@ -510,9 +506,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -510,9 +506,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
void
*
oldprivate
;
void
*
oldprivate
;
size_t
oldprivatelen
;
size_t
oldprivatelen
;
if
(
copy_from_user
(
&
user
,
if
(
copy_from_user
(
&
user
,
argp
,
sizeof
(
user
)))
(
struct
ncp_objectname_ioctl
*
)
arg
,
return
-
EFAULT
;
sizeof
(
user
)))
return
-
EFAULT
;
if
(
user
.
object_name_len
>
NCP_OBJECT_NAME_MAX_LEN
)
if
(
user
.
object_name_len
>
NCP_OBJECT_NAME_MAX_LEN
)
return
-
ENOMEM
;
return
-
ENOMEM
;
if
(
user
.
object_name_len
)
{
if
(
user
.
object_name_len
)
{
...
@@ -550,9 +545,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -550,9 +545,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
struct
ncp_privatedata_ioctl
user
;
struct
ncp_privatedata_ioctl
user
;
size_t
outl
;
size_t
outl
;
if
(
copy_from_user
(
&
user
,
if
(
copy_from_user
(
&
user
,
argp
,
sizeof
(
user
)))
(
struct
ncp_privatedata_ioctl
*
)
arg
,
return
-
EFAULT
;
sizeof
(
user
)))
return
-
EFAULT
;
outl
=
user
.
len
;
outl
=
user
.
len
;
user
.
len
=
server
->
priv
.
len
;
user
.
len
=
server
->
priv
.
len
;
if
(
outl
>
user
.
len
)
outl
=
user
.
len
;
if
(
outl
>
user
.
len
)
outl
=
user
.
len
;
...
@@ -561,9 +555,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -561,9 +555,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
server
->
priv
.
data
,
server
->
priv
.
data
,
outl
))
return
-
EFAULT
;
outl
))
return
-
EFAULT
;
}
}
if
(
copy_to_user
((
struct
ncp_privatedata_ioctl
*
)
arg
,
if
(
copy_to_user
(
argp
,
&
user
,
sizeof
(
user
)))
&
user
,
return
-
EFAULT
;
sizeof
(
user
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
NCP_IOC_SETPRIVATEDATA
:
case
NCP_IOC_SETPRIVATEDATA
:
...
@@ -576,9 +569,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -576,9 +569,8 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
void
*
old
;
void
*
old
;
size_t
oldlen
;
size_t
oldlen
;
if
(
copy_from_user
(
&
user
,
if
(
copy_from_user
(
&
user
,
argp
,
sizeof
(
user
)))
(
struct
ncp_privatedata_ioctl
*
)
arg
,
return
-
EFAULT
;
sizeof
(
user
)))
return
-
EFAULT
;
if
(
user
.
len
>
NCP_PRIVATE_DATA_MAX_LEN
)
if
(
user
.
len
>
NCP_PRIVATE_DATA_MAX_LEN
)
return
-
ENOMEM
;
return
-
ENOMEM
;
if
(
user
.
len
)
{
if
(
user
.
len
)
{
...
@@ -603,10 +595,10 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -603,10 +595,10 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
#ifdef CONFIG_NCPFS_NLS
#ifdef CONFIG_NCPFS_NLS
case
NCP_IOC_SETCHARSETS
:
case
NCP_IOC_SETCHARSETS
:
return
ncp_set_charsets
(
server
,
(
struct
ncp_nls_ioctl
*
)
arg
);
return
ncp_set_charsets
(
server
,
argp
);
case
NCP_IOC_GETCHARSETS
:
case
NCP_IOC_GETCHARSETS
:
return
ncp_get_charsets
(
server
,
(
struct
ncp_nls_ioctl
*
)
arg
);
return
ncp_get_charsets
(
server
,
argp
);
#endif
/* CONFIG_NCPFS_NLS */
#endif
/* CONFIG_NCPFS_NLS */
...
@@ -617,7 +609,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -617,7 +609,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
{
{
u_int32_t
user
;
u_int32_t
user
;
if
(
copy_from_user
(
&
user
,
(
u_int32_t
*
)
arg
,
sizeof
(
user
)))
if
(
copy_from_user
(
&
user
,
argp
,
sizeof
(
user
)))
return
-
EFAULT
;
return
-
EFAULT
;
/* 20 secs at most... */
/* 20 secs at most... */
if
(
user
>
20000
)
if
(
user
>
20000
)
...
@@ -630,7 +622,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -630,7 +622,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
case
NCP_IOC_GETDENTRYTTL
:
case
NCP_IOC_GETDENTRYTTL
:
{
{
u_int32_t
user
=
(
server
->
dentry_ttl
*
1000
)
/
HZ
;
u_int32_t
user
=
(
server
->
dentry_ttl
*
1000
)
/
HZ
;
if
(
copy_to_user
(
(
u_int32_t
*
)
arg
,
&
user
,
sizeof
(
user
)))
if
(
copy_to_user
(
argp
,
&
user
,
sizeof
(
user
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
@@ -646,7 +638,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
...
@@ -646,7 +638,7 @@ int ncp_ioctl(struct inode *inode, struct file *filp,
return
-
EACCES
;
return
-
EACCES
;
}
}
SET_UID
(
uid
,
server
->
m
.
mounted_uid
);
SET_UID
(
uid
,
server
->
m
.
mounted_uid
);
if
(
put_user
(
uid
,
(
__kernel_uid_t
*
)
arg
))
if
(
put_user
(
uid
,
(
__kernel_uid_t
__user
*
)
argp
))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
...
...
include/linux/ncp_fs.h
View file @
78d759d8
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
struct
ncp_ioctl_request
{
struct
ncp_ioctl_request
{
unsigned
int
function
;
unsigned
int
function
;
unsigned
int
size
;
unsigned
int
size
;
char
*
data
;
char
__user
*
data
;
};
};
struct
ncp_fs_info
{
struct
ncp_fs_info
{
...
@@ -88,13 +88,13 @@ struct ncp_objectname_ioctl
...
@@ -88,13 +88,13 @@ struct ncp_objectname_ioctl
#define NCP_AUTH_NDS 0x32
#define NCP_AUTH_NDS 0x32
int
auth_type
;
int
auth_type
;
size_t
object_name_len
;
size_t
object_name_len
;
void
*
object_name
;
/* an userspace data, in most cases user name */
void
__user
*
object_name
;
/* an userspace data, in most cases user name */
};
};
struct
ncp_privatedata_ioctl
struct
ncp_privatedata_ioctl
{
{
size_t
len
;
size_t
len
;
void
*
data
;
/* ~1000 for NDS */
void
__user
*
data
;
/* ~1000 for NDS */
};
};
/* NLS charsets by ioctl */
/* NLS charsets by ioctl */
...
...
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