fs/vboxsf/super.c:390 vboxsf_parse_monolithic() warn: impossible condition == (255)) => ((-128)-127 == 255)'

From: Dan Carpenter
Date: Mon Aug 24 2020 - 09:10:36 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: c3d8f220d01220a5b253e422be407d068dc65511
commit: 0fd169576648452725fa2949bf391d10883d3991 fs: Add VirtualBox guest shared folder (vboxsf) support
config: x86_64-randconfig-m001-20200824 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 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>

New smatch warnings:
fs/vboxsf/super.c:390 vboxsf_parse_monolithic() warn: impossible condition '(options[1] == (255)) => ((-128)-127 == 255)'

Old smatch warnings:
fs/vboxsf/super.c:391 vboxsf_parse_monolithic() warn: impossible condition '(options[2] == (254)) => ((-128)-127 == 254)'
fs/vboxsf/super.c:392 vboxsf_parse_monolithic() warn: impossible condition '(options[3] == (253)) => ((-128)-127 == 253)'

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0fd169576648452725fa2949bf391d10883d3991
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0fd169576648452725fa2949bf391d10883d3991
vim +390 fs/vboxsf/super.c

0fd16957664845 Hans de Goede 2019-12-12 385 static int vboxsf_parse_monolithic(struct fs_context *fc, void *data)
0fd16957664845 Hans de Goede 2019-12-12 386 {
0fd16957664845 Hans de Goede 2019-12-12 387 char *options = data;
0fd16957664845 Hans de Goede 2019-12-12 388
0fd16957664845 Hans de Goede 2019-12-12 389 if (options && options[0] == VBSF_MOUNT_SIGNATURE_BYTE_0 &&
0fd16957664845 Hans de Goede 2019-12-12 @390 options[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 &&
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Impossible.

0fd16957664845 Hans de Goede 2019-12-12 391 options[2] == VBSF_MOUNT_SIGNATURE_BYTE_2 &&
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0fd16957664845 Hans de Goede 2019-12-12 392 options[3] == VBSF_MOUNT_SIGNATURE_BYTE_3) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0fd16957664845 Hans de Goede 2019-12-12 393 vbg_err("vboxsf: Old binary mount data not supported, remove obsolete mount.vboxsf and/or update your VBoxService.\n");
0fd16957664845 Hans de Goede 2019-12-12 394 return -EINVAL;
0fd16957664845 Hans de Goede 2019-12-12 395 }
0fd16957664845 Hans de Goede 2019-12-12 396
0fd16957664845 Hans de Goede 2019-12-12 397 return generic_parse_monolithic(fc, data);
0fd16957664845 Hans de Goede 2019-12-12 398 }

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

Attachment: .config.gz
Description: application/gzip