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

Sean Hefty mshefty at ichips.intel.com
Wed Apr 26 08:57:09 PDT 2006


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.  Maybe this would be better?

- Sean



More information about the general mailing list