lkml.org 
[lkml]   [2013]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] 9p: unsigned/signed wrap in p9/unix modes.
From
Date
On Mon, 2013-10-07 at 19:19 -0300, Geyslan G. Bem wrote:
> Changes the sign type to unsigned, avoiding the possibility of
> wrap when ORing the p9 or unix bit modes.
[]
> diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
[]
> @@ -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);

This bit changes the MKDEV below it.

I would think that the sscanf return should be
checked for 3 and maybe MKDEV should not be
constructed when it's not.




\
 
 \ /
  Last update: 2013-10-08 00:41    [W:0.059 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site