diff options
author | Dave Airlie <airlied@starflyer.(none)> | 2006-01-02 05:19:39 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-01-02 05:19:39 -0500 |
commit | fe34765be1ee9465b10406e6e5dddbd43ddc4fbe (patch) | |
tree | 0e9ec196e83729b7a10f941c5429878d11ae51b5 /drivers/char/drm | |
parent | b3a80a223d5f1af1e1713383376e5472cec4e20c (diff) |
drm: drm_ioctl.c sync with fixes from CVS
Apply the fixes from CVS that were outstanding for this file
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm')
-rw-r--r-- | drivers/char/drm/drm_ioctl.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c index a654ac17a900..bcd4e604d3ec 100644 --- a/drivers/char/drm/drm_ioctl.c +++ b/drivers/char/drm/drm_ioctl.c | |||
@@ -137,17 +137,22 @@ int drm_setunique(struct inode *inode, struct file *filp, | |||
137 | 137 | ||
138 | static int drm_set_busid(drm_device_t * dev) | 138 | static int drm_set_busid(drm_device_t * dev) |
139 | { | 139 | { |
140 | int len; | ||
141 | |||
140 | if (dev->unique != NULL) | 142 | if (dev->unique != NULL) |
141 | return EBUSY; | 143 | return EBUSY; |
142 | 144 | ||
143 | dev->unique_len = 20; | 145 | dev->unique_len = 40; |
144 | dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER); | 146 | dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER); |
145 | if (dev->unique == NULL) | 147 | if (dev->unique == NULL) |
146 | return ENOMEM; | 148 | return ENOMEM; |
147 | 149 | ||
148 | snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", | 150 | len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", |
149 | dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); | 151 | dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); |
150 | 152 | ||
153 | if (len > dev->unique_len) | ||
154 | DRM_ERROR("Unique buffer overflowed\n"); | ||
155 | |||
151 | dev->devname = | 156 | dev->devname = |
152 | drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + | 157 | drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + |
153 | 2, DRM_MEM_DRIVER); | 158 | 2, DRM_MEM_DRIVER); |
@@ -239,7 +244,7 @@ int drm_getclient(struct inode *inode, struct file *filp, | |||
239 | { | 244 | { |
240 | drm_file_t *priv = filp->private_data; | 245 | drm_file_t *priv = filp->private_data; |
241 | drm_device_t *dev = priv->head->dev; | 246 | drm_device_t *dev = priv->head->dev; |
242 | drm_client_t __user *argp = (void __user *)arg; | 247 | drm_client_t __user *argp = (drm_client_t __user *)arg; |
243 | drm_client_t client; | 248 | drm_client_t client; |
244 | drm_file_t *pt; | 249 | drm_file_t *pt; |
245 | int idx; | 250 | int idx; |
@@ -262,7 +267,7 @@ int drm_getclient(struct inode *inode, struct file *filp, | |||
262 | client.iocs = pt->ioctl_count; | 267 | client.iocs = pt->ioctl_count; |
263 | up(&dev->struct_sem); | 268 | up(&dev->struct_sem); |
264 | 269 | ||
265 | if (copy_to_user((drm_client_t __user *) arg, &client, sizeof(client))) | 270 | if (copy_to_user(argp, &client, sizeof(client))) |
266 | return -EFAULT; | 271 | return -EFAULT; |
267 | return 0; | 272 | return 0; |
268 | } | 273 | } |
@@ -339,7 +344,7 @@ int drm_setversion(DRM_IOCTL_ARGS) | |||
339 | if (sv.drm_di_major != DRM_IF_MAJOR || | 344 | if (sv.drm_di_major != DRM_IF_MAJOR || |
340 | sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) | 345 | sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) |
341 | return EINVAL; | 346 | return EINVAL; |
342 | if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor); | 347 | if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor); |
343 | dev->if_version = DRM_MAX(if_version, dev->if_version); | 348 | dev->if_version = DRM_MAX(if_version, dev->if_version); |
344 | if (sv.drm_di_minor >= 1) { | 349 | if (sv.drm_di_minor >= 1) { |
345 | /* | 350 | /* |