[dhowells-fs:fscache-iter-2 51/75] fs/cachefiles/namei.c:295 cachefiles_create_file() warn: signedness bug returning '(-4095)'

From: Dan Carpenter
Date: Fri Sep 10 2021 - 08:57:10 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git fscache-iter-2
head: 7c7521adffeb04466a42e8e1956353b9d9038d02
commit: 8a939333f451cb4296510d0c9783edf1b915ad9e [51/75] cachefiles: Rearrange file lookup/creation/check to simplify
config: i386-randconfig-m021-20210910 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
fs/cachefiles/namei.c:295 cachefiles_create_file() warn: signedness bug returning '(-4095)'

vim +295 fs/cachefiles/namei.c

8a939333f451cb David Howells 2021-06-09 282 static bool cachefiles_create_file(struct cachefiles_object *object)
9ae326a69004de David Howells 2009-04-03 283 {
8a939333f451cb David Howells 2021-06-09 284 struct file *file;
c8e2ee13a8662a David Howells 2021-05-20 285 int ret;
9ae326a69004de David Howells 2009-04-03 286
8a939333f451cb David Howells 2021-06-09 287 fscache_cookie_lookup_negative(object->cookie);
9ae326a69004de David Howells 2009-04-03 288
8a939333f451cb David Howells 2021-06-09 289 ret = cachefiles_has_space(object->volume->cache, 1, 0);
c8e2ee13a8662a David Howells 2021-05-20 290 if (ret < 0)
8a939333f451cb David Howells 2021-06-09 291 return false;
9ae326a69004de David Howells 2009-04-03 292
8a939333f451cb David Howells 2021-06-09 293 file = cachefiles_create_tmpfile(object);
8a939333f451cb David Howells 2021-06-09 294 if (IS_ERR(file))
8a939333f451cb David Howells 2021-06-09 @295 return PTR_ERR(file);

This should be "return false;"

9ae326a69004de David Howells 2009-04-03 296
8a939333f451cb David Howells 2021-06-09 297 set_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags);
8a939333f451cb David Howells 2021-06-09 298 _debug("create -> %pD{ino=%lu}", file, file_inode(file)->i_ino);
8a939333f451cb David Howells 2021-06-09 299 object->file = file;
8a939333f451cb David Howells 2021-06-09 300 return true;
a18feb55769b70 David Howells 2018-04-04 301 }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx