diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2008-12-02 07:40:11 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2009-04-02 06:29:52 -0400 |
commit | 87bc730c07a0884d14d6af5c9d49f4669c0a0589 (patch) | |
tree | aae3f3b6286526e16ee9614923d227612affe51e /fs/udf | |
parent | e650b94addfbf072952df762e6f1c6c9e26c4f9c (diff) |
udf: fix default mode and dmode options handling
On x86 (and several other archs) mode_t is defined as "unsigned short"
and comparing unsigned shorts to negative ints is broken (because short
is promoted to int and then compared). Fix it.
Reported-and-tested-by: Laurent Riffard <laurent.riffard@free.fr>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/inode.c | 4 | ||||
-rw-r--r-- | fs/udf/super.c | 8 | ||||
-rw-r--r-- | fs/udf/udf_sb.h | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 1456d238f8f8..e7533f785636 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1223,10 +1223,10 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh) | |||
1223 | iinfo->i_lenExtents = inode->i_size; | 1223 | iinfo->i_lenExtents = inode->i_size; |
1224 | 1224 | ||
1225 | if (fe->icbTag.fileType != ICBTAG_FILE_TYPE_DIRECTORY && | 1225 | if (fe->icbTag.fileType != ICBTAG_FILE_TYPE_DIRECTORY && |
1226 | sbi->s_fmode != -1) | 1226 | sbi->s_fmode != UDF_INVALID_MODE) |
1227 | inode->i_mode = sbi->s_fmode; | 1227 | inode->i_mode = sbi->s_fmode; |
1228 | else if (fe->icbTag.fileType == ICBTAG_FILE_TYPE_DIRECTORY && | 1228 | else if (fe->icbTag.fileType == ICBTAG_FILE_TYPE_DIRECTORY && |
1229 | sbi->s_dmode != -1) | 1229 | sbi->s_dmode != UDF_INVALID_MODE) |
1230 | inode->i_mode = sbi->s_dmode; | 1230 | inode->i_mode = sbi->s_dmode; |
1231 | else | 1231 | else |
1232 | inode->i_mode = udf_convert_permissions(fe); | 1232 | inode->i_mode = udf_convert_permissions(fe); |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 0368bf60f42b..b9dc6adfdd2d 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -284,9 +284,9 @@ static int udf_show_options(struct seq_file *seq, struct vfsmount *mnt) | |||
284 | seq_printf(seq, ",gid=%u", sbi->s_gid); | 284 | seq_printf(seq, ",gid=%u", sbi->s_gid); |
285 | if (sbi->s_umask != 0) | 285 | if (sbi->s_umask != 0) |
286 | seq_printf(seq, ",umask=%o", sbi->s_umask); | 286 | seq_printf(seq, ",umask=%o", sbi->s_umask); |
287 | if (sbi->s_fmode != -1) | 287 | if (sbi->s_fmode != UDF_INVALID_MODE) |
288 | seq_printf(seq, ",mode=%o", sbi->s_fmode); | 288 | seq_printf(seq, ",mode=%o", sbi->s_fmode); |
289 | if (sbi->s_dmode != -1) | 289 | if (sbi->s_dmode != UDF_INVALID_MODE) |
290 | seq_printf(seq, ",dmode=%o", sbi->s_dmode); | 290 | seq_printf(seq, ",dmode=%o", sbi->s_dmode); |
291 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) | 291 | if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) |
292 | seq_printf(seq, ",session=%u", sbi->s_session); | 292 | seq_printf(seq, ",session=%u", sbi->s_session); |
@@ -1892,8 +1892,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
1892 | uopt.uid = -1; | 1892 | uopt.uid = -1; |
1893 | uopt.gid = -1; | 1893 | uopt.gid = -1; |
1894 | uopt.umask = 0; | 1894 | uopt.umask = 0; |
1895 | uopt.fmode = -1; | 1895 | uopt.fmode = UDF_INVALID_MODE; |
1896 | uopt.dmode = -1; | 1896 | uopt.dmode = UDF_INVALID_MODE; |
1897 | 1897 | ||
1898 | sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); | 1898 | sbi = kzalloc(sizeof(struct udf_sb_info), GFP_KERNEL); |
1899 | if (!sbi) | 1899 | if (!sbi) |
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 5d32c609fceb..158221ecdc42 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h | |||
@@ -48,6 +48,8 @@ | |||
48 | #define UDF_SPARABLE_MAP15 0x1522U | 48 | #define UDF_SPARABLE_MAP15 0x1522U |
49 | #define UDF_METADATA_MAP25 0x2511U | 49 | #define UDF_METADATA_MAP25 0x2511U |
50 | 50 | ||
51 | #define UDF_INVALID_MODE ((mode_t)-1) | ||
52 | |||
51 | #pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */ | 53 | #pragma pack(1) /* XXX(hch): Why? This file just defines in-core structures */ |
52 | 54 | ||
53 | struct udf_meta_data { | 55 | struct udf_meta_data { |