Re: [PATCH] char:misc minor is overflowing

From: One Thousand Gnomes
Date: Wed Dec 09 2015 - 08:35:54 EST


On Wed, 09 Dec 2015 12:51:33 +0000 (GMT)
Nitin Gupta <nitin.gupta@xxxxxxxxxxx> wrote:

> Hi,
>
> Is there any modification / improvement needed in this patch ?
>
> ------- Original Message -------
> Sender : Shivnandan Kumar<shivnandan.k@xxxxxxxxxxx> Engineer/SRI-Noida-Advance Solutions - System 1 R&D Group/Samsung Electronics
> Date : Nov 20, 2015 15:35 (GMT+05:30)
> Title : [PATCH] char:misc minor is overflowing
>
> When a driver register as a misc driver and
> it tries to allocate minor number dynamically.
> Then there is a chance of minor number overflow.
> The problem is that 64(DYNAMIC_MINORS) is not enough

If you are allocating more than the odd minor number you shouldn't be
using misc devices in the first place but should be using
cdev_init/cdev_add/register_chrdev_region and friends.

So 64 really should never be "not enough". miscdevice is more historical
than useful and really goes back to the days long before all the region
allocators existed.

Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/