diff options
author | Andrew Gabbasov <andrew_gabbasov@mentor.com> | 2016-01-15 09:44:21 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2016-02-09 13:05:23 +0100 |
commit | 9fba70569d9c3c253dba10ebbe3359f2157e504c (patch) | |
tree | 2a6cd413e2c978a4217c9fe58afa2221199d5a3c /fs/udf/namei.c | |
parent | udf: Join functions for UTF8 and NLS conversions (diff) | |
download | linux-9fba70569d9c3c253dba10ebbe3359f2157e504c.tar.xz linux-9fba70569d9c3c253dba10ebbe3359f2157e504c.zip |
udf: Adjust UDF_NAME_LEN to better reflect actual restrictions
Actual name length restriction is 254 bytes, this is used in 'ustr'
structure, and this is what fits into UDF File Ident structures.
And in most cases the constant is used as UDF_NAME_LEN-2.
So, it's better to just modify the constant to make it closer
to reality.
Also, in some cases it's useful to have a separate constant for
the maximum length of file name field in CS0 encoding in UDF File
Ident structures.
Also, remove the unused UDF_PATH_LEN constant.
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/namei.c')
-rw-r--r-- | fs/udf/namei.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index f82c70d73aba..9eb9c6440270 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c @@ -291,7 +291,7 @@ static struct dentry *udf_lookup(struct inode *dir, struct dentry *dentry, struct udf_fileident_bh fibh; struct fileIdentDesc *fi; - if (dentry->d_name.len > UDF_NAME_LEN - 2) + if (dentry->d_name.len > UDF_NAME_LEN) return ERR_PTR(-ENAMETOOLONG); #ifdef UDF_RECOVERY @@ -351,7 +351,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, struct udf_inode_info *dinfo; fibh->sbh = fibh->ebh = NULL; - name = kmalloc(UDF_NAME_LEN, GFP_NOFS); + name = kmalloc(UDF_NAME_LEN_CS0, GFP_NOFS); if (!name) { *err = -ENOMEM; goto out_err; @@ -364,7 +364,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir, } namelen = udf_put_filename(sb, dentry->d_name.name, dentry->d_name.len, - name, UDF_NAME_LEN); + name, UDF_NAME_LEN_CS0); if (!namelen) { *err = -ENAMETOOLONG; goto out_err; @@ -915,7 +915,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, iinfo = UDF_I(inode); down_write(&iinfo->i_data_sem); - name = kmalloc(UDF_NAME_LEN, GFP_NOFS); + name = kmalloc(UDF_NAME_LEN_CS0, GFP_NOFS); if (!name) { err = -ENOMEM; goto out_no_entry; @@ -1000,7 +1000,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry, if (pc->componentType == 5) { namelen = udf_put_filename(sb, compstart, symname - compstart, - name, UDF_NAME_LEN); + name, UDF_NAME_LEN_CS0); if (!namelen) goto out_no_entry; |