* [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
@ 2022-08-01 9:22 studentxswpy
2022-08-01 18:23 ` Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: studentxswpy @ 2022-08-01 9:22 UTC (permalink / raw)
To: jaegeuk, chao, linux-f2fs-devel, linux-kernel; +Cc: Xie Shaowen, Hacash Robot
From: Xie Shaowen <studentxswpy@163.com>
replace kmalloc with f2fs_kmalloc to keep f2fs code consistency.
Reported-by: Hacash Robot <hacashRobot@santino.com>
Signed-off-by: Xie Shaowen <studentxswpy@163.com>
---
fs/f2fs/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
index d5bd7932fb64..712b51f69c04 100644
--- a/fs/f2fs/dir.c
+++ b/fs/f2fs/dir.c
@@ -232,7 +232,7 @@ static int f2fs_match_ci_name(const struct inode *dir, const struct qstr *name,
if (WARN_ON_ONCE(!fscrypt_has_encryption_key(dir)))
return -EINVAL;
- decrypted_name.name = kmalloc(de_name_len, GFP_KERNEL);
+ decrypted_name.name = f2fs_kmalloc(de_name_len, GFP_KERNEL);
if (!decrypted_name.name)
return -ENOMEM;
res = fscrypt_fname_disk_to_usr(dir, 0, 0, &encrypted_name,
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
2022-08-01 9:22 [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc studentxswpy
@ 2022-08-01 18:23 ` Christoph Hellwig
2022-08-02 1:42 ` Joe Perches
2022-08-04 3:56 ` Jaegeuk Kim
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2022-08-01 18:23 UTC (permalink / raw)
To: studentxswpy; +Cc: jaegeuk, chao, linux-f2fs-devel, linux-kernel, Hacash Robot
On Mon, Aug 01, 2022 at 05:22:02PM +0800, studentxswpy@163.com wrote:
> From: Xie Shaowen <studentxswpy@163.com>
>
> replace kmalloc with f2fs_kmalloc to keep f2fs code consistency.
For that removing f2fs_kmalloc entirely would be way better.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
2022-08-01 18:23 ` Christoph Hellwig
@ 2022-08-02 1:42 ` Joe Perches
2022-08-04 3:54 ` Jaegeuk Kim
0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2022-08-02 1:42 UTC (permalink / raw)
To: Christoph Hellwig, studentxswpy
Cc: jaegeuk, chao, linux-f2fs-devel, linux-kernel, Hacash Robot
On Mon, 2022-08-01 at 11:23 -0700, Christoph Hellwig wrote:
> On Mon, Aug 01, 2022 at 05:22:02PM +0800, studentxswpy@163.com wrote:
> > From: Xie Shaowen <studentxswpy@163.com>
> >
> > replace kmalloc with f2fs_kmalloc to keep f2fs code consistency.
>
> For that removing f2fs_kmalloc entirely would be way better.
Dunno, maybe doubtful as there's a specific "fault injector" test
built around f2fs_<foo>alloc. (CONFIG_F2FS_FAULT_INJECTION)
For a student lesson, it would significantly better to compile any
patch, especially to avoid broken patches, before submitting them.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
2022-08-02 1:42 ` Joe Perches
@ 2022-08-04 3:54 ` Jaegeuk Kim
2022-08-04 13:50 ` Chao Yu
0 siblings, 1 reply; 8+ messages in thread
From: Jaegeuk Kim @ 2022-08-04 3:54 UTC (permalink / raw)
To: Joe Perches
Cc: Christoph Hellwig, studentxswpy, chao, linux-f2fs-devel,
linux-kernel, Hacash Robot
On 08/01, Joe Perches wrote:
> On Mon, 2022-08-01 at 11:23 -0700, Christoph Hellwig wrote:
> > On Mon, Aug 01, 2022 at 05:22:02PM +0800, studentxswpy@163.com wrote:
> > > From: Xie Shaowen <studentxswpy@163.com>
> > >
> > > replace kmalloc with f2fs_kmalloc to keep f2fs code consistency.
> >
> > For that removing f2fs_kmalloc entirely would be way better.
>
> Dunno, maybe doubtful as there's a specific "fault injector" test
> built around f2fs_<foo>alloc. (CONFIG_F2FS_FAULT_INJECTION)
Yes, it's very useful to run the test checking the ENOMEM case.
>
> For a student lesson, it would significantly better to compile any
> patch, especially to avoid broken patches, before submitting them.
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
2022-08-01 9:22 [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc studentxswpy
2022-08-01 18:23 ` Christoph Hellwig
@ 2022-08-04 3:56 ` Jaegeuk Kim
2022-08-07 8:29 ` kernel test robot
2022-08-07 8:29 ` kernel test robot
3 siblings, 0 replies; 8+ messages in thread
From: Jaegeuk Kim @ 2022-08-04 3:56 UTC (permalink / raw)
To: studentxswpy; +Cc: chao, linux-f2fs-devel, linux-kernel, Hacash Robot
On 08/01, studentxswpy@163.com wrote:
> From: Xie Shaowen <studentxswpy@163.com>
>
> replace kmalloc with f2fs_kmalloc to keep f2fs code consistency.
>
> Reported-by: Hacash Robot <hacashRobot@santino.com>
> Signed-off-by: Xie Shaowen <studentxswpy@163.com>
> ---
> fs/f2fs/dir.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c
> index d5bd7932fb64..712b51f69c04 100644
> --- a/fs/f2fs/dir.c
> +++ b/fs/f2fs/dir.c
> @@ -232,7 +232,7 @@ static int f2fs_match_ci_name(const struct inode *dir, const struct qstr *name,
> if (WARN_ON_ONCE(!fscrypt_has_encryption_key(dir)))
> return -EINVAL;
>
> - decrypted_name.name = kmalloc(de_name_len, GFP_KERNEL);
> + decrypted_name.name = f2fs_kmalloc(de_name_len, GFP_KERNEL);
Please fix the build breakage.
fyi;
static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi, size_t size, gfp_t flags)
> if (!decrypted_name.name)
> return -ENOMEM;
> res = fscrypt_fname_disk_to_usr(dir, 0, 0, &encrypted_name,
> --
> 2.25.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
2022-08-04 3:54 ` Jaegeuk Kim
@ 2022-08-04 13:50 ` Chao Yu
0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2022-08-04 13:50 UTC (permalink / raw)
To: Jaegeuk Kim, Joe Perches
Cc: Christoph Hellwig, studentxswpy, linux-f2fs-devel, linux-kernel,
Hacash Robot
On 2022/8/4 11:54, Jaegeuk Kim wrote:
> On 08/01, Joe Perches wrote:
>> On Mon, 2022-08-01 at 11:23 -0700, Christoph Hellwig wrote:
>>> On Mon, Aug 01, 2022 at 05:22:02PM +0800, studentxswpy@163.com wrote:
>>>> From: Xie Shaowen <studentxswpy@163.com>
>>>>
>>>> replace kmalloc with f2fs_kmalloc to keep f2fs code consistency.
>>>
>>> For that removing f2fs_kmalloc entirely would be way better.
>>
>> Dunno, maybe doubtful as there's a specific "fault injector" test
>> built around f2fs_<foo>alloc. (CONFIG_F2FS_FAULT_INJECTION)
>
> Yes, it's very useful to run the test checking the ENOMEM case.
It's useful to cover more error paths for xxx_alloc functions in f2fs
with common testcases.
>
>>
>> For a student lesson, it would significantly better to compile any
>> patch, especially to avoid broken patches, before submitting them.
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
2022-08-01 9:22 [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc studentxswpy
2022-08-01 18:23 ` Christoph Hellwig
2022-08-04 3:56 ` Jaegeuk Kim
@ 2022-08-07 8:29 ` kernel test robot
2022-08-07 8:29 ` kernel test robot
3 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-08-07 8:29 UTC (permalink / raw)
To: studentxswpy, jaegeuk, chao, linux-f2fs-devel, linux-kernel
Cc: llvm, kbuild-all, Xie Shaowen, Hacash Robot
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on next-20220728]
url: https://github.com/intel-lab-lkp/linux/commits/studentxswpy-163-com/f2fs-Replace-kmalloc-with-f2fs_kmalloc/20220801-172502
base: 7c5e07b73ff3011c9b82d4a3286a3362b951ad2b
config: x86_64-randconfig-a002-20220801 (https://download.01.org/0day-ci/archive/20220807/202208071605.XXehjTqy-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 52cd00cabf479aa7eb6dbb063b7ba41ea57bce9e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/ca9f7259448a8dc0a2c4a1ae0a34a8109df4d6e1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review studentxswpy-163-com/f2fs-Replace-kmalloc-with-f2fs_kmalloc/20220801-172502
git checkout ca9f7259448a8dc0a2c4a1ae0a34a8109df4d6e1
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/f2fs/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> fs/f2fs/dir.c:235:61: error: too few arguments to function call, expected 3, have 2
decrypted_name.name = f2fs_kmalloc(de_name_len, GFP_KERNEL);
~~~~~~~~~~~~ ^
fs/f2fs/f2fs.h:3316:21: note: 'f2fs_kmalloc' declared here
static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi,
^
1 error generated.
vim +235 fs/f2fs/dir.c
211
212 #if IS_ENABLED(CONFIG_UNICODE)
213 /*
214 * Test whether a case-insensitive directory entry matches the filename
215 * being searched for.
216 *
217 * Returns 1 for a match, 0 for no match, and -errno on an error.
218 */
219 static int f2fs_match_ci_name(const struct inode *dir, const struct qstr *name,
220 const u8 *de_name, u32 de_name_len)
221 {
222 const struct super_block *sb = dir->i_sb;
223 const struct unicode_map *um = sb->s_encoding;
224 struct fscrypt_str decrypted_name = FSTR_INIT(NULL, de_name_len);
225 struct qstr entry = QSTR_INIT(de_name, de_name_len);
226 int res;
227
228 if (IS_ENCRYPTED(dir)) {
229 const struct fscrypt_str encrypted_name =
230 FSTR_INIT((u8 *)de_name, de_name_len);
231
232 if (WARN_ON_ONCE(!fscrypt_has_encryption_key(dir)))
233 return -EINVAL;
234
> 235 decrypted_name.name = f2fs_kmalloc(de_name_len, GFP_KERNEL);
236 if (!decrypted_name.name)
237 return -ENOMEM;
238 res = fscrypt_fname_disk_to_usr(dir, 0, 0, &encrypted_name,
239 &decrypted_name);
240 if (res < 0)
241 goto out;
242 entry.name = decrypted_name.name;
243 entry.len = decrypted_name.len;
244 }
245
246 res = utf8_strncasecmp_folded(um, name, &entry);
247 /*
248 * In strict mode, ignore invalid names. In non-strict mode,
249 * fall back to treating them as opaque byte sequences.
250 */
251 if (res < 0 && !sb_has_strict_encoding(sb)) {
252 res = name->len == entry.len &&
253 memcmp(name->name, entry.name, name->len) == 0;
254 } else {
255 /* utf8_strncasecmp_folded returns 0 on match */
256 res = (res == 0);
257 }
258 out:
259 kfree(decrypted_name.name);
260 return res;
261 }
262 #endif /* CONFIG_UNICODE */
263
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc
2022-08-01 9:22 [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc studentxswpy
` (2 preceding siblings ...)
2022-08-07 8:29 ` kernel test robot
@ 2022-08-07 8:29 ` kernel test robot
3 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-08-07 8:29 UTC (permalink / raw)
To: studentxswpy, jaegeuk, chao, linux-f2fs-devel, linux-kernel
Cc: kbuild-all, Xie Shaowen, Hacash Robot
Hi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20220728]
url: https://github.com/intel-lab-lkp/linux/commits/studentxswpy-163-com/f2fs-Replace-kmalloc-with-f2fs_kmalloc/20220801-172502
base: 7c5e07b73ff3011c9b82d4a3286a3362b951ad2b
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220807/202208071655.jHZ9QodB-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ca9f7259448a8dc0a2c4a1ae0a34a8109df4d6e1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review studentxswpy-163-com/f2fs-Replace-kmalloc-with-f2fs_kmalloc/20220801-172502
git checkout ca9f7259448a8dc0a2c4a1ae0a34a8109df4d6e1
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/f2fs/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
fs/f2fs/dir.c: In function 'f2fs_match_ci_name':
>> fs/f2fs/dir.c:235:52: warning: passing argument 1 of 'f2fs_kmalloc' makes pointer from integer without a cast [-Wint-conversion]
235 | decrypted_name.name = f2fs_kmalloc(de_name_len, GFP_KERNEL);
| ^~~~~~~~~~~
| |
| u32 {aka unsigned int}
In file included from fs/f2fs/dir.c:13:
fs/f2fs/f2fs.h:3316:55: note: expected 'struct f2fs_sb_info *' but argument is of type 'u32' {aka 'unsigned int'}
3316 | static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi,
| ~~~~~~~~~~~~~~~~~~~~~^~~
fs/f2fs/dir.c:235:39: error: too few arguments to function 'f2fs_kmalloc'
235 | decrypted_name.name = f2fs_kmalloc(de_name_len, GFP_KERNEL);
| ^~~~~~~~~~~~
In file included from fs/f2fs/dir.c:13:
fs/f2fs/f2fs.h:3316:21: note: declared here
3316 | static inline void *f2fs_kmalloc(struct f2fs_sb_info *sbi,
| ^~~~~~~~~~~~
vim +/f2fs_kmalloc +235 fs/f2fs/dir.c
211
212 #if IS_ENABLED(CONFIG_UNICODE)
213 /*
214 * Test whether a case-insensitive directory entry matches the filename
215 * being searched for.
216 *
217 * Returns 1 for a match, 0 for no match, and -errno on an error.
218 */
219 static int f2fs_match_ci_name(const struct inode *dir, const struct qstr *name,
220 const u8 *de_name, u32 de_name_len)
221 {
222 const struct super_block *sb = dir->i_sb;
223 const struct unicode_map *um = sb->s_encoding;
224 struct fscrypt_str decrypted_name = FSTR_INIT(NULL, de_name_len);
225 struct qstr entry = QSTR_INIT(de_name, de_name_len);
226 int res;
227
228 if (IS_ENCRYPTED(dir)) {
229 const struct fscrypt_str encrypted_name =
230 FSTR_INIT((u8 *)de_name, de_name_len);
231
232 if (WARN_ON_ONCE(!fscrypt_has_encryption_key(dir)))
233 return -EINVAL;
234
> 235 decrypted_name.name = f2fs_kmalloc(de_name_len, GFP_KERNEL);
236 if (!decrypted_name.name)
237 return -ENOMEM;
238 res = fscrypt_fname_disk_to_usr(dir, 0, 0, &encrypted_name,
239 &decrypted_name);
240 if (res < 0)
241 goto out;
242 entry.name = decrypted_name.name;
243 entry.len = decrypted_name.len;
244 }
245
246 res = utf8_strncasecmp_folded(um, name, &entry);
247 /*
248 * In strict mode, ignore invalid names. In non-strict mode,
249 * fall back to treating them as opaque byte sequences.
250 */
251 if (res < 0 && !sb_has_strict_encoding(sb)) {
252 res = name->len == entry.len &&
253 memcmp(name->name, entry.name, name->len) == 0;
254 } else {
255 /* utf8_strncasecmp_folded returns 0 on match */
256 res = (res == 0);
257 }
258 out:
259 kfree(decrypted_name.name);
260 return res;
261 }
262 #endif /* CONFIG_UNICODE */
263
--
0-DAY CI Kernel Test Service
https://01.org/lkp
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-08-07 8:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 9:22 [PATCH -next] f2fs: Replace kmalloc() with f2fs_kmalloc studentxswpy
2022-08-01 18:23 ` Christoph Hellwig
2022-08-02 1:42 ` Joe Perches
2022-08-04 3:54 ` Jaegeuk Kim
2022-08-04 13:50 ` Chao Yu
2022-08-04 3:56 ` Jaegeuk Kim
2022-08-07 8:29 ` kernel test robot
2022-08-07 8:29 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).