]> Pileus Git - ~andy/linux/blobdiff - drivers/uio/uio.c
Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux...
[~andy/linux] / drivers / uio / uio.c
index 10a029b24159a818e4bf4c83f8ae0bdc2b926524..d2efe823c20dd7fc317a1ffc0e12c283138e531d 100644 (file)
@@ -381,7 +381,13 @@ static int uio_get_minor(struct uio_device *idev)
                        retval = -ENOMEM;
                goto exit;
        }
-       idev->minor = id & MAX_ID_MASK;
+       if (id < UIO_MAX_DEVICES) {
+               idev->minor = id;
+       } else {
+               dev_err(idev->dev, "too many uio devices\n");
+               retval = -EINVAL;
+               idr_remove(&uio_idr, id);
+       }
 exit:
        mutex_unlock(&minor_lock);
        return retval;