Re: [PATCH] IB/ucm: Fix compiling ucm.c

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

 



Hi Jason,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v4.18 next-20180813]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Jason-Gunthorpe/IB-ucm-Fix-compiling-ucm-c/20180814-173031
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/infiniband/core/ucm.c:498:38: sparse: incorrect type in argument 2 (incompatible argument 2 (different modifiers)) @@    expected int ( *[usertype] cm_handler )( ... ) @@    got rtype] cm_handler )( ... ) @@
   drivers/infiniband/core/ucm.c:498:38:    expected int ( *[usertype] cm_handler )( ... )
   drivers/infiniband/core/ucm.c:498:38:    got int ( *<noident> )( ... )
   drivers/infiniband/core/ucm.c: In function 'ib_ucm_create_id':
   drivers/infiniband/core/ucm.c:498:10: error: passing argument 2 of 'ib_create_cm_id' from incompatible pointer type [-Werror=incompatible-pointer-types]
             ib_ucm_event_handler, ctx);
             ^~~~~~~~~~~~~~~~~~~~
   In file included from drivers/infiniband/core/ucm.c:52:0:
   include/rdma/ib_cm.h:326:18: note: expected 'ib_cm_handler {aka int (*)(struct ib_cm_id *, struct ib_cm_event *)}' but argument is of type 'int (*)(struct ib_cm_id *, const struct ib_cm_event *)'
    struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
                     ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +498 drivers/infiniband/core/ucm.c

a5b745407 Hal Rosenstock  2005-07-27  474  
a5b745407 Hal Rosenstock  2005-07-27  475  static ssize_t ib_ucm_create_id(struct ib_ucm_file *file,
a5b745407 Hal Rosenstock  2005-07-27  476  				const char __user *inbuf,
a5b745407 Hal Rosenstock  2005-07-27  477  				int in_len, int out_len)
a5b745407 Hal Rosenstock  2005-07-27  478  {
a5b745407 Hal Rosenstock  2005-07-27  479  	struct ib_ucm_create_id cmd;
a5b745407 Hal Rosenstock  2005-07-27  480  	struct ib_ucm_create_id_resp resp;
a5b745407 Hal Rosenstock  2005-07-27  481  	struct ib_ucm_context *ctx;
a5b745407 Hal Rosenstock  2005-07-27  482  	int result;
a5b745407 Hal Rosenstock  2005-07-27  483  
a5b745407 Hal Rosenstock  2005-07-27  484  	if (out_len < sizeof(resp))
a5b745407 Hal Rosenstock  2005-07-27  485  		return -ENOSPC;
a5b745407 Hal Rosenstock  2005-07-27  486  
a5b745407 Hal Rosenstock  2005-07-27  487  	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
a5b745407 Hal Rosenstock  2005-07-27  488  		return -EFAULT;
a5b745407 Hal Rosenstock  2005-07-27  489  
4be10c1e6 Sean Hefty      2006-05-25  490  	mutex_lock(&file->file_mutex);
a5b745407 Hal Rosenstock  2005-07-27  491  	ctx = ib_ucm_ctx_alloc(file);
4be10c1e6 Sean Hefty      2006-05-25  492  	mutex_unlock(&file->file_mutex);
a5b745407 Hal Rosenstock  2005-07-27  493  	if (!ctx)
a5b745407 Hal Rosenstock  2005-07-27  494  		return -ENOMEM;
a5b745407 Hal Rosenstock  2005-07-27  495  
0b2b35f68 Sean Hefty      2005-09-01  496  	ctx->uid = cmd.uid;
07d357d0c Sean Hefty      2005-10-17  497  	ctx->cm_id = ib_create_cm_id(file->device->ib_dev,
07d357d0c Sean Hefty      2005-10-17 @498  				     ib_ucm_event_handler, ctx);
b9ef520f9 Sean Hefty      2005-08-19  499  	if (IS_ERR(ctx->cm_id)) {
b9ef520f9 Sean Hefty      2005-08-19  500  		result = PTR_ERR(ctx->cm_id);
07d357d0c Sean Hefty      2005-10-17  501  		goto err1;
a5b745407 Hal Rosenstock  2005-07-27  502  	}
a5b745407 Hal Rosenstock  2005-07-27  503  
a5b745407 Hal Rosenstock  2005-07-27  504  	resp.id = ctx->id;
6f57c933a Jason Gunthorpe 2018-03-27  505  	if (copy_to_user(u64_to_user_ptr(cmd.response),
a5b745407 Hal Rosenstock  2005-07-27  506  			 &resp, sizeof(resp))) {
a5b745407 Hal Rosenstock  2005-07-27  507  		result = -EFAULT;
07d357d0c Sean Hefty      2005-10-17  508  		goto err2;
a5b745407 Hal Rosenstock  2005-07-27  509  	}
a5b745407 Hal Rosenstock  2005-07-27  510  	return 0;
a5b745407 Hal Rosenstock  2005-07-27  511  
07d357d0c Sean Hefty      2005-10-17  512  err2:
07d357d0c Sean Hefty      2005-10-17  513  	ib_destroy_cm_id(ctx->cm_id);
07d357d0c Sean Hefty      2005-10-17  514  err1:
95ed644fd Ingo Molnar     2006-01-13  515  	mutex_lock(&ctx_id_mutex);
0b2b35f68 Sean Hefty      2005-09-01  516  	idr_remove(&ctx_id_table, ctx->id);
95ed644fd Ingo Molnar     2006-01-13  517  	mutex_unlock(&ctx_id_mutex);
0b2b35f68 Sean Hefty      2005-09-01  518  	kfree(ctx);
a5b745407 Hal Rosenstock  2005-07-27  519  	return result;
a5b745407 Hal Rosenstock  2005-07-27  520  }
a5b745407 Hal Rosenstock  2005-07-27  521  

:::::: The code at line 498 was first introduced by commit
:::::: 07d357d0cbf89d9980b1769d5444a3c70f000e00 [IB] CM: bind IDs to a specific device

:::::: TO: Sean Hefty <sean.hefty@xxxxxxxxx>
:::::: CC: Roland Dreier <rolandd@xxxxxxxxx>

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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux