[linux-next:master 13883/13946] drivers//tee/tee_shm.c:257:28: error: expected ')' before ';' token

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   d47175169c28eedd2cc2ab8c01f38764cb0269cc
commit: 3a58003c0e1752c459539b82594ff382ddce161d [13883/13946] tee/shm: untag user pointers in tee_shm_register
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout 3a58003c0e1752c459539b82594ff382ddce161d
        # save the attached .config to linux build tree
        GCC_VERSION=7.4.0 make.cross ARCH=sparc64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

   drivers//tee/tee_shm.c: In function 'tee_shm_register':
>> drivers//tee/tee_shm.c:257:28: error: expected ')' before ';' token
     addr = untagged_addr(addr);
                               ^
>> drivers//tee/tee_shm.c:334:1: error: expected ';' before '}' token
    }
    ^
>> drivers//tee/tee_shm.c:250:3: error: label 'err' used but not defined
      goto err;
      ^~~~
   drivers//tee/tee_shm.c:231:16: warning: unused variable 'start' [-Wunused-variable]
     unsigned long start;
                   ^~~~~
   drivers//tee/tee_shm.c:230:6: warning: unused variable 'num_pages' [-Wunused-variable]
     int num_pages;
         ^~~~~~~~~
   drivers//tee/tee_shm.c:229:6: warning: unused variable 'rc' [-Wunused-variable]
     int rc;
         ^~
>> drivers//tee/tee_shm.c:334:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

vim +257 drivers//tee/tee_shm.c

   221	
   222	struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
   223					 size_t length, u32 flags)
   224	{
   225		struct tee_device *teedev = ctx->teedev;
   226		const u32 req_flags = TEE_SHM_DMA_BUF | TEE_SHM_USER_MAPPED;
   227		struct tee_shm *shm;
   228		void *ret;
   229		int rc;
   230		int num_pages;
 > 231		unsigned long start;
   232	
   233		if (flags != req_flags)
   234			return ERR_PTR(-ENOTSUPP);
   235	
   236		if (!tee_device_get(teedev))
   237			return ERR_PTR(-EINVAL);
   238	
   239		if (!teedev->desc->ops->shm_register ||
   240		    !teedev->desc->ops->shm_unregister) {
   241			tee_device_put(teedev);
   242			return ERR_PTR(-ENOTSUPP);
   243		}
   244	
   245		teedev_ctx_get(ctx);
   246	
   247		shm = kzalloc(sizeof(*shm), GFP_KERNEL);
   248		if (!shm) {
   249			ret = ERR_PTR(-ENOMEM);
 > 250			goto err;
   251		}
   252	
   253		shm->flags = flags | TEE_SHM_REGISTER;
   254		shm->teedev = teedev;
   255		shm->ctx = ctx;
   256		shm->id = -1;
 > 257		addr = untagged_addr(addr);
   258		start = rounddown(addr, PAGE_SIZE);
   259		shm->offset = addr - start;
   260		shm->size = length;
   261		num_pages = (roundup(addr + length, PAGE_SIZE) - start) / PAGE_SIZE;
   262		shm->pages = kcalloc(num_pages, sizeof(*shm->pages), GFP_KERNEL);
   263		if (!shm->pages) {
   264			ret = ERR_PTR(-ENOMEM);
   265			goto err;
   266		}
   267	
   268		rc = get_user_pages_fast(start, num_pages, FOLL_WRITE, shm->pages);
   269		if (rc > 0)
   270			shm->num_pages = rc;
   271		if (rc != num_pages) {
   272			if (rc >= 0)
   273				rc = -ENOMEM;
   274			ret = ERR_PTR(rc);
   275			goto err;
   276		}
   277	
   278		mutex_lock(&teedev->mutex);
   279		shm->id = idr_alloc(&teedev->idr, shm, 1, 0, GFP_KERNEL);
   280		mutex_unlock(&teedev->mutex);
   281	
   282		if (shm->id < 0) {
   283			ret = ERR_PTR(shm->id);
   284			goto err;
   285		}
   286	
   287		rc = teedev->desc->ops->shm_register(ctx, shm, shm->pages,
   288						     shm->num_pages, start);
   289		if (rc) {
   290			ret = ERR_PTR(rc);
   291			goto err;
   292		}
   293	
   294		if (flags & TEE_SHM_DMA_BUF) {
   295			DEFINE_DMA_BUF_EXPORT_INFO(exp_info);
   296	
   297			exp_info.ops = &tee_shm_dma_buf_ops;
   298			exp_info.size = shm->size;
   299			exp_info.flags = O_RDWR;
   300			exp_info.priv = shm;
   301	
   302			shm->dmabuf = dma_buf_export(&exp_info);
   303			if (IS_ERR(shm->dmabuf)) {
   304				ret = ERR_CAST(shm->dmabuf);
   305				teedev->desc->ops->shm_unregister(ctx, shm);
   306				goto err;
   307			}
   308		}
   309	
   310		mutex_lock(&teedev->mutex);
   311		list_add_tail(&shm->link, &ctx->list_shm);
   312		mutex_unlock(&teedev->mutex);
   313	
   314		return shm;
   315	err:
   316		if (shm) {
   317			size_t n;
   318	
   319			if (shm->id >= 0) {
   320				mutex_lock(&teedev->mutex);
   321				idr_remove(&teedev->idr, shm->id);
   322				mutex_unlock(&teedev->mutex);
   323			}
   324			if (shm->pages) {
   325				for (n = 0; n < shm->num_pages; n++)
   326					put_page(shm->pages[n]);
   327				kfree(shm->pages);
   328			}
   329		}
   330		kfree(shm);
   331		teedev_ctx_put(ctx);
   332		tee_device_put(teedev);
   333		return ret;
 > 334	}
   335	EXPORT_SYMBOL_GPL(tee_shm_register);
   336	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux