Fixed SDO download via library.
--- a/master/cdev.c Tue Feb 24 09:11:19 2009 +0000
+++ b/master/cdev.c Tue Feb 24 10:03:53 2009 +0000
@@ -2273,6 +2273,7 @@
ec_ioctl_sdo_request_t data;
ec_slave_config_t *sc;
ec_sdo_request_t *req;
+ int ret;
if (unlikely(!priv->requested))
return -EPERM;
@@ -2280,6 +2281,11 @@
if (copy_from_user(&data, (void __user *) arg, sizeof(data)))
return -EFAULT;
+ if (!data.size) {
+ EC_ERR("Sdo download: Data size may not be zero!\n");
+ return -EINVAL;
+ }
+
if (down_interruptible(&master->master_sem))
return -EINTR;
@@ -2295,6 +2301,14 @@
up(&master->master_sem);
+ ret = ec_sdo_request_alloc(req, data.size);
+ if (ret)
+ return ret;
+
+ if (copy_from_user(req->data, (void __user *) data.data, data.size))
+ return -EFAULT;
+
+ req->data_size = data.size;
ecrt_sdo_request_write(req);
return 0;
}