lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202108130245.yreVnhXi-lkp@intel.com>
Date:   Fri, 13 Aug 2021 12:37:53 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Haren Myneni <haren@...ux.ibm.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        Michael Ellerman <mpe@...erman.id.au>,
        Nicholas Piggin <npiggin@...il.com>
Subject: arch/powerpc/platforms/book3s/vas-api.c:100 coproc_ioc_tx_win_open()
 error: we previously assumed 'cp_inst->coproc->vops' could be null (see line
 100)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1746f4db513563bb22e0ba0c419d0c90912dfae1
commit: 1a0d0d5ed5e3cd9e3fc1ad4459f1db2f3618fce0 powerpc/vas: Add platform specific user window operations
config: powerpc64-randconfig-m031-20210812 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 10.3.0

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

smatch warnings:
arch/powerpc/platforms/book3s/vas-api.c:100 coproc_ioc_tx_win_open() error: we previously assumed 'cp_inst->coproc->vops' could be null (see line 100)
arch/powerpc/platforms/book3s/vas-api.c:170 coproc_mmap() error: we previously assumed 'cp_inst->coproc->vops' could be null (see line 170)

vim +100 arch/powerpc/platforms/book3s/vas-api.c

dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   73  static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg)
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   74  {
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   75  	void __user *uptr = (void __user *)arg;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   76  	struct vas_tx_win_open_attr uattr;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   77  	struct coproc_instance *cp_inst;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   78  	struct vas_window *txwin;
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17   79  	int rc;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   80  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   81  	cp_inst = fp->private_data;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   82  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   83  	/*
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   84  	 * One window for file descriptor
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   85  	 */
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   86  	if (cp_inst->txwin)
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   87  		return -EEXIST;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   88  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   89  	rc = copy_from_user(&uattr, uptr, sizeof(uattr));
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   90  	if (rc) {
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   91  		pr_err("%s(): copy_from_user() returns %d\n", __func__, rc);
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   92  		return -EFAULT;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   93  	}
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   94  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   95  	if (uattr.version != 1) {
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17   96  		pr_err("Invalid window open API version\n");
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   97  		return -EINVAL;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   98  	}
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17   99  
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17 @100  	if (!cp_inst->coproc->vops && !cp_inst->coproc->vops->open_win) {
                                                                                                                   ^^
This was intended to be ||.

1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  101  		pr_err("VAS API is not registered\n");
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  102  		return -EACCES;
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  103  	}
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  104  
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  105  	txwin = cp_inst->coproc->vops->open_win(uattr.vas_id, uattr.flags,
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  106  						cp_inst->coproc->cop_type);
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  107  	if (IS_ERR(txwin)) {
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  108  		pr_err("%s() VAS window open failed, %ld\n", __func__,
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  109  				PTR_ERR(txwin));
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  110  		return PTR_ERR(txwin);
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  111  	}
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  112  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  113  	cp_inst->txwin = txwin;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  114  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  115  	return 0;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  116  }

[ snip ]

dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  147  static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  148  {
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  149  	struct coproc_instance *cp_inst = fp->private_data;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  150  	struct vas_window *txwin;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  151  	unsigned long pfn;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  152  	u64 paste_addr;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  153  	pgprot_t prot;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  154  	int rc;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  155  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  156  	txwin = cp_inst->txwin;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  157  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  158  	if ((vma->vm_end - vma->vm_start) > PAGE_SIZE) {
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  159  		pr_debug("%s(): size 0x%zx, PAGE_SIZE 0x%zx\n", __func__,
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  160  				(vma->vm_end - vma->vm_start), PAGE_SIZE);
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  161  		return -EINVAL;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  162  	}
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  163  
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  164  	/* Ensure instance has an open send window */
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  165  	if (!txwin) {
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  166  		pr_err("%s(): No send window open?\n", __func__);
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  167  		return -EINVAL;
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  168  	}
dda44eb29c2357 arch/powerpc/platforms/powernv/vas-api.c Haren Myneni 2020-04-17  169  
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17 @170  	if (!cp_inst->coproc->vops && !cp_inst->coproc->vops->paste_addr) {
                                                                                                                   ^^
Same.

1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  171  		pr_err("%s(): VAS API is not registered\n", __func__);
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  172  		return -EACCES;
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  173  	}
1a0d0d5ed5e3cd arch/powerpc/platforms/book3s/vas-api.c  Haren Myneni 2021-06-17  174  

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ