mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 9p: unsigned/signed wrap in p9/unix modes.
@ 2013-10-07 22:19 Geyslan G. Bem
  2013-10-07 22:33 ` Joe Perches
  0 siblings, 1 reply; 10+ messages in thread
From: Geyslan G. Bem @ 2013-10-07 22:19 UTC (permalink / raw)
  To: ericvh, rminnich, lucho, v9fs-developer
  Cc: linux-kernel, kernel-br, Geyslan G. Bem

Changes the sign type to unsigned, avoiding the possibility of
wrap when ORing the p9 or unix bit modes.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 fs/9p/vfs_inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index b352457..574095e 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -63,7 +63,7 @@ static const struct inode_operations v9fs_symlink_inode_operations;
 
 static u32 unixmode2p9mode(struct v9fs_session_info *v9ses, umode_t mode)
 {
-	int res;
+	u32 res;
 	res = mode & 0777;
 	if (S_ISDIR(mode))
 		res |= P9_DMDIR;
@@ -125,7 +125,7 @@ static int p9mode2perm(struct v9fs_session_info *v9ses,
 static umode_t p9mode2unixmode(struct v9fs_session_info *v9ses,
 			       struct p9_wstat *stat, dev_t *rdev)
 {
-	int res;
+	umode_t res;
 	u32 mode = stat->mode;
 
 	*rdev = 0;
@@ -144,7 +144,7 @@ static umode_t p9mode2unixmode(struct v9fs_session_info *v9ses,
 	else if ((mode & P9_DMDEVICE) && (v9fs_proto_dotu(v9ses))
 		 && (v9ses->nodev == 0)) {
 		char type = 0, ext[32];
-		int major = -1, minor = -1;
+		u32 major = 0, minor = 0;
 
 		strlcpy(ext, stat->extension, sizeof(ext));
 		sscanf(ext, "%c %u %u", &type, &major, &minor);
-- 
1.8.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-10-29 20:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-07 22:19 [PATCH] 9p: unsigned/signed wrap in p9/unix modes Geyslan G. Bem
2013-10-07 22:33 ` Joe Perches
2013-10-08  0:09   ` Geyslan Gregório Bem
2013-10-08  0:12     ` Joe Perches
2013-10-08  0:18       ` Geyslan Gregório Bem
     [not found]         ` <CAFkjPTmFOkw5n964zGuiON1oLSy1CsPQQ8TrGNho6L-+M5Z7SA@mail.gmail.com>
2013-10-21 11:03           ` Geyslan Gregório Bem
2013-10-21 21:13             ` Geyslan Gregório Bem
2013-10-22 10:35               ` Geyslan Gregório Bem
     [not found]                 ` <CAFkjPTm_JhrWVzk0njqaUwpn5RxqYgRWYV2ZvPyrYoFKZHkgog@mail.gmail.com>
     [not found]                   ` <CAGG-pURzs512=6zu2_vBz5vtJu3Dm8hsdV=qZuUa5GJng6Eceg@mail.gmail.com>
2013-10-29  1:48                     ` Geyslan Gregório Bem
2013-10-29 20:59                       ` Geyslan Gregório Bem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®