Jia-Ye Li
6e58fc14d7
staging: exfat: Use kvzalloc() instead of kzalloc() for exfat_sb_info
...
Fix mount failed "Cannot allocate memory".
When the memory gets fragmented, kzalloc() might fail to allocate
physically contiguous pages for the struct exfat_sb_info (its size is
about 34KiB) even the total free memory is enough.
Use kvzalloc() to solve this problem.
Reviewed-by: Ethan Wu <ethanwu@synology.com >
Signed-off-by: Jia-Ye Li <jiayeli@synology.com >
Link: https://lore.kernel.org/r/20190925083729.4653-1-jiayeli@synology.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-10-04 10:20:57 +02:00
Masanari Iida
89d5f78fab
staging: exfat: Fix a typo in Kconfig
...
This patch fix a spelling typo in Kconfig.
Signed-off-by: Masanari Iida <standby24x7@gmail.com >
Link: https://lore.kernel.org/r/20190930130504.21994-1-standby24x7@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-10-01 08:16:04 +02:00
Valdis Klētnieks
a358eea07c
staging: exfat - fix SPDX tags..
...
The copyright notices as I got them said "GPLv2 or later", which I
screwed up when putting in the SPDX tags. Fix them to match the
license I got the code under.
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu >
Link: https://lore.kernel.org/r/122590.1568853488@turing-police
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-10-01 08:15:57 +02:00
Michael Straube
ec1db1be10
staging: exfat: add missing SPDX line to Kconfig
...
Add SPDX identifier to Kconfig.
Signed-off-by: Michael Straube <straube.linux@gmail.com >
Link: https://lore.kernel.org/r/20190917190755.21723-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-10-01 08:15:45 +02:00
Valentin Vidic
2d70718dd5
staging: exfat: drop unused function parameter
...
sbi parameter not used inside the function so remove it.
Also cleanup unused variables generated by this change.
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190908173539.26963-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-12 10:29:29 +01:00
Sandro Volery
56a583d264
Staging: exfat: Avoid use of strcpy
...
Use strscpy instead of strcpy in exfat_core.c, and add a check
for length that will return already known FFS_INVALIDPATH.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk >
Signed-off-by: Sandro Volery <sandro@volery.com >
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com >
Link: https://lore.kernel.org/r/20190912082559.GA5043@volery
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-12 10:25:05 +01:00
Valentin Vidic
4e35a0d87c
staging: exfat: use integer constants
...
Replace manually generated values with predefined constants.
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190908152616.25459-3-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-12 10:25:05 +01:00
Valentin Vidic
0e739ba8e2
staging: exfat: cleanup spacing for casts
...
Fix checkpatch.pl warnings:
CHECK: No space is necessary after a cast
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190908152616.25459-2-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-12 10:25:05 +01:00
Valentin Vidic
179e14c8e6
staging: exfat: cleanup spacing for operators
...
Fixes checkpatch.pl warnings:
CHECK: spaces preferred around that '-' (ctx:VxV)
CHECK: spaces preferred around that '+' (ctx:VxV)
CHECK: spaces preferred around that '*' (ctx:VxV)
CHECK: spaces preferred around that '|' (ctx:VxV)
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190908152616.25459-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-12 10:25:04 +01:00
Arnd Bergmann
44f6b40c22
staging: exfat: stop using 32-bit time_t
...
time_t suffers from overflow problems and should not be used.
In exfat, it is currently used in two open-coded time64_to_tm()
implementations. Changes those to use the existing function instead.
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Link: https://lore.kernel.org/r/20190906150917.1025250-2-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-06 18:20:28 +02:00
Arnd Bergmann
26cf766091
staging: exfat: stopusing CONFIG_FAT_DEFAULT_IOCHARSET
...
When CONFIG_VFAT_FS is disabled, the reference to CONFIG_FAT_DEFAULT_IOCHARSET
causes a link failure:
drivers/staging/exfat/exfat_super.c:46:41: error: use of undeclared identifier 'CONFIG_FAT_DEFAULT_IOCHARSET'
static char exfat_default_iocharset[] = CONFIG_FAT_DEFAULT_IOCHARSET;
I could not figure out why the correct code is commented
out, but using that fixes the problem.
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Link: https://lore.kernel.org/r/20190906150917.1025250-1-arnd@arndb.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-06 18:20:21 +02:00
YueHaibing
f30bd2989b
staging: exfat: Use kmemdup in exfat_symlink()
...
Use kmemdup rather than duplicating its implementation
Signed-off-by: YueHaibing <yuehaibing@huawei.com >
Link: https://lore.kernel.org/r/20190905030047.88401-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 09:37:31 +02:00
YueHaibing
981cdf7d57
staging: exfat: remove unused including <linux/version.h>
...
Remove including <linux/version.h> that don't need it.
Signed-off-by: YueHaibing <yuehaibing@huawei.com >
Link: https://lore.kernel.org/r/20190905025623.63210-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 09:37:31 +02:00
YueHaibing
0f16ebb9dc
staging: exfat: remove duplicated include from exfat_super.c
...
Remove duplicated include.
Signed-off-by: YueHaibing <yuehaibing@huawei.com >
Link: https://lore.kernel.org/r/20190905025608.61884-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-05 09:37:31 +02:00
zhong jiang
59d45f2a4d
staging: exfat: remove the redundant check when kfree an object in exfat_destroy_inode
...
kfree has taken the null check in account. hence it is unnecessary to add the
null check before kfree the object. Just remove it.
Reported-by: Julia Lawall <julia.lawall@lip6.fr >
Signed-off-by: zhong jiang <zhongjiang@huawei.com >
Link: https://lore.kernel.org/r/1567591408-24268-1-git-send-email-zhongjiang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-04 19:14:46 +02:00
Dan Carpenter
7f95bb6aa3
staging: exfat: Fix two missing unlocks on error paths
...
These two error paths need to unlock before we can return.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Link: https://lore.kernel.org/r/20190904095908.GA7007@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-04 19:14:45 +02:00
Valentin Vidic
3b531807e6
staging: exfat: cleanup explicit comparisons to NULL
...
Fixes checkpatch.pl warnings:
CHECK: Comparison to NULL could be written "expr"
CHECK: Comparison to NULL could be written "!expr"
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190903205659.18856-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-04 08:25:23 +02:00
Valentin Vidic
dfa5b30b12
staging: exfat: drop local TRUE/FALSE defines
...
Replace with bool where it makes sense. Also drop unused local
variable lossy in fat_find_dir_entry.
Reported-by: Al Viro <viro@zeniv.linux.org.uk >
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190903185537.25099-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 22:10:00 +02:00
Valentin Vidic
ab050766f9
staging: exfat: fix spelling errors in comments
...
Fixes checkpatch.pl warnings:
CHECK: 'consistancy' may be misspelled - perhaps 'consistency'?
CHECK: 'stuct' may be misspelled - perhaps 'struct'?
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190903165408.16010-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 22:07:06 +02:00
Valentin Vidic
a70cfd89dc
staging: exfat: cleanup braces for if/else statements
...
Fixes checkpatch.pl warnings:
CHECK: Unbalanced braces around else statement
CHECK: braces {} should be used on all arms of this statement
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190903164732.14194-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 22:05:51 +02:00
Colin Ian King
dab8fe7ea2
staging: exfat: check for null return from call to FAT_getblk
...
A call to FAT_getblk is missing a null return check which can
lead to a null pointer dereference. Fix this by adding a null
check to match all the other FAT_getblk return sanity checks.
Addresses-Coverity: ("Dereference null return")
Fixes: c48c9f7ff3 ("staging: exfat: add exfat filesystem code to staging")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Link: https://lore.kernel.org/r/20190830175050.12706-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 09:39:10 +02:00
Colin Ian King
be22bc7ceb
staging: exfat: remove return and error return via a goto
...
The return statement is incorrect, the error exit should be by
assigning ret with the error code and exiting via label out.
Thanks to Valdis Klētnieks for correcting my original fix.
Addresses-Coverity: ("Structurally dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Link: https://lore.kernel.org/r/20190902094052.28029-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 09:36:07 +02:00
Colin Ian King
076a8e2f76
staging: exfat: fix uninitialized variable ret
...
Currently there are error return paths in ffsReadFile that
exit via lable err_out that return and uninitialized error
return in variable ret. Fix this by initializing ret to zero.
Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: c48c9f7ff3 ("staging: exfat: add exfat filesystem code to staging")
Signed-off-by: Colin Ian King <colin.king@canonical.com >
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu >,
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com >
Link: https://lore.kernel.org/r/20190830184644.15590-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 09:36:07 +02:00
Valentin Vidic
ef16b89c82
staging: exfat: use BIT macro for defining sizes
...
Fixes checkpatch.pl warning:
CHECK: Prefer using the BIT macro
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190902184319.11971-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 09:00:30 +02:00
Valentin Vidic
5b489e2ff6
staging: exfat: cleanup blank line warnings
...
Fixes checkpatch.pl warnings:
CHECK: Please don't use multiple blank lines
CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Please use a blank line after function/struct/union/enum
declarations
Signed-off-by: Valentin Vidic <vvidic@valentin-vidic.from.hr >
Link: https://lore.kernel.org/r/20190902190329.18685-1-vvidic@valentin-vidic.from.hr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-03 09:00:29 +02:00
Greg Kroah-Hartman
544b3e7fd2
staging: exfat: make exfat depend on BLOCK
...
This should fix a build error in some configurations when CONFIG_BLOCK
is not selected. Also properly set the dependancy for no FAT support at
the same time.
Reported-by: Randy Dunlap <rdunlap@infradead.org >
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu >
Link: https://lore.kernel.org/r/20190902174631.GB31445@kroah.com
Acked-by: Randy Dunlap <rdunlap@infradead.org > # build-tested
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-02 20:13:50 +02:00
Valdis Klētnieks
58985a9d2d
drivers/staging/exfat - by default, prohibit mount of fat/vfat
...
Concerns have been raised about the exfat driver accidentally mounting
fat/vfat file systems. Add an extra configure option to help prevent that.
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu >
Link: https://lore.kernel.org/r/245727.1567183359@turing-police
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-09-02 10:44:13 +02:00
Valdis Klētnieks
c48c9f7ff3
staging: exfat: add exfat filesystem code to staging
...
The exfat code needs a lot of work to get it into "real" shape for
the fs/ part of the kernel, so put it into drivers/staging/ for now so
that it can be worked on by everyone in the community.
The full specification of the filesystem can be found at:
https://docs.microsoft.com/en-us/windows/win32/fileio/exfat-specification
Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu >
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
Link: https://lore.kernel.org/r/20190828160817.6250-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2019-08-30 08:55:08 +02:00