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
661f482b
Commit
661f482b
authored
Oct 07, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid warnings in uid/gid usage by making the assignment
unconditional. Simplify the macros.
parent
2cec2dff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
27 deletions
+12
-27
fs/smbfs/ioctl.c
fs/smbfs/ioctl.c
+2
-2
include/linux/highuid.h
include/linux/highuid.h
+10
-25
No files found.
fs/smbfs/ioctl.c
View file @
661f482b
...
...
@@ -31,8 +31,8 @@ smb_ioctl(struct inode *inode, struct file *filp,
int
result
=
-
EINVAL
;
switch
(
cmd
)
{
uid16_t
uid16
=
0
;
uid_t
uid32
=
0
;
uid16_t
uid16
;
uid_t
uid32
;
case
SMB_IOC_GETMOUNTUID
:
SET_UID
(
uid16
,
server
->
mnt
->
mounted_uid
);
result
=
put_user
(
uid16
,
(
uid16_t
*
)
arg
);
...
...
include/linux/highuid.h
View file @
661f482b
...
...
@@ -53,37 +53,22 @@ extern void __bad_gid(void);
#define low2highuid(uid) ((uid) == (old_uid_t)-1 ? (uid_t)-1 : (uid_t)(uid))
#define low2highgid(gid) ((gid) == (old_gid_t)-1 ? (gid_t)-1 : (gid_t)(gid))
/* uid/gid input should be always 32bit uid_t */
#define SET_UID(var, uid) \
do { \
if (sizeof(var) == sizeof(old_uid_t)) (var) = high2lowuid(uid); \
else if (sizeof(var) >= sizeof(uid)) (var) = (uid); \
else __bad_uid(); \
} while(0)
#define SET_GID(var, gid) \
do { \
if (sizeof(var) == sizeof(old_gid_t)) (var) = high2lowgid(gid); \
else if (sizeof(var) >= sizeof(gid)) (var) = (gid); \
else __bad_gid(); \
} while(0)
#define __convert_uid(size, uid) \
(size >= sizeof(uid) ? (uid) : high2lowuid(uid))
#define __convert_gid(size, gid) \
(size >= sizeof(gid) ? (gid) : high2lowgid(gid))
#else
#define SET_UID(var,uid) \
do { \
if (sizeof(var) < sizeof(uid)) __bad_uid(); \
(var) = (uid); \
} while (0)
#define SET_GID(var,gid) \
do { \
if (sizeof(var) < sizeof(gid)) __bad_gid(); \
(var) = (gid); \
} while (0);
#define __convert_uid(size, uid) (uid)
#define __convert_gid(size, gid) (gid)
#endif
/* !CONFIG_UID16 */
/* uid/gid input should be always 32bit uid_t */
#define SET_UID(var, uid) do { (var) = __convert_uid(sizeof(var), (uid)); } while (0)
#define SET_GID(var, gid) do { (var) = __convert_gid(sizeof(var), (gid)); } while (0)
/*
* Everything below this line is needed on all architectures, to deal with
...
...
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