[openib-general] [RFC] [PATCH 1/3] RDMA CM: addrdma_get/set_optioncalls to get/set path records

Michael S. Tsirkin mst at mellanox.co.il
Wed Apr 26 09:13:52 PDT 2006


Quoting r. Sean Hefty <mshefty at ichips.intel.com>:
> Subject: Re: [openib-general] [RFC] [PATCH 1/3] RDMA CM:?addrdma_get/set_optioncalls to get/set path records
> 
> Michael S. Tsirkin wrote:
> >Sean, what's up with patch numbering?
> 
> The second patch labeled 1/3 is really 2/3.  I resent 2/3 with the correct 
> subject heading.
> 
> >>+static ssize_t ucma_set_option(struct ucma_file *file, const char __user 
> >>*inbuf,
> >>+			       int in_len, int out_len)
> >>+{
> >>+	struct rdma_ucm_set_option cmd;
> >>+	struct ucma_context *ctx;
> >>+	int ret;
> >>+
> >>+	if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
> >>+		return -EFAULT;
> >>+
> >>+	ctx = ucma_get_ctx(file, cmd.id);
> >>+	if (IS_ERR(ctx))
> >>+		return PTR_ERR(ctx);
> >>+
> >>+	ret = rdma_set_option(ctx->cm_id, cmd.level, cmd.optname,
> >>+			      (void *) (unsigned long) cmd.optval,
> >>+			      cmd.optlen);
> >
> >
> >Casting a value from userspace to void * looks iffy.
> 
> This should be a userspace pointer.  The kernel setsockopt interface takes 
> a char * for the option value.

Where is it?

> Maybe this would be better?
> 
> - Sean
> 

I think it would be better to have rdma_set_path/rdma_get_path,
for kernel consumers, and have ucma handle copying from/to userspace. No?

-- 
MST



More information about the general mailing list