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>

authored by Dave Airlie and committed by Dave Airlie fe34765b b3a80a22

+10 -5
+10 -5
drivers/char/drm/drm_ioctl.c
··· 137 138 static int drm_set_busid(drm_device_t * dev) 139 { 140 if (dev->unique != NULL) 141 return EBUSY; 142 143 - dev->unique_len = 20; 144 dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER); 145 if (dev->unique == NULL) 146 return ENOMEM; 147 148 - snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", 149 dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); 150 151 dev->devname = 152 drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + ··· 244 { 245 drm_file_t *priv = filp->private_data; 246 drm_device_t *dev = priv->head->dev; 247 - drm_client_t __user *argp = (void __user *)arg; 248 drm_client_t client; 249 drm_file_t *pt; 250 int idx; ··· 267 client.iocs = pt->ioctl_count; 268 up(&dev->struct_sem); 269 270 - if (copy_to_user((drm_client_t __user *) arg, &client, sizeof(client))) 271 return -EFAULT; 272 return 0; 273 } ··· 344 if (sv.drm_di_major != DRM_IF_MAJOR || 345 sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) 346 return EINVAL; 347 - if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor); 348 dev->if_version = DRM_MAX(if_version, dev->if_version); 349 if (sv.drm_di_minor >= 1) { 350 /*
··· 137 138 static int drm_set_busid(drm_device_t * dev) 139 { 140 + int len; 141 + 142 if (dev->unique != NULL) 143 return EBUSY; 144 145 + dev->unique_len = 40; 146 dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER); 147 if (dev->unique == NULL) 148 return ENOMEM; 149 150 + len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d", 151 dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func); 152 + 153 + if (len > dev->unique_len) 154 + DRM_ERROR("Unique buffer overflowed\n"); 155 156 dev->devname = 157 drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + ··· 239 { 240 drm_file_t *priv = filp->private_data; 241 drm_device_t *dev = priv->head->dev; 242 + drm_client_t __user *argp = (drm_client_t __user *)arg; 243 drm_client_t client; 244 drm_file_t *pt; 245 int idx; ··· 262 client.iocs = pt->ioctl_count; 263 up(&dev->struct_sem); 264 265 + if (copy_to_user(argp, &client, sizeof(client))) 266 return -EFAULT; 267 return 0; 268 } ··· 339 if (sv.drm_di_major != DRM_IF_MAJOR || 340 sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) 341 return EINVAL; 342 + if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor); 343 dev->if_version = DRM_MAX(if_version, dev->if_version); 344 if (sv.drm_di_minor >= 1) { 345 /*