Signed-off-by: Anubhav Rakshit <anubhavrocks@xxxxxxxxx> --- fs/char_dev.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/char_dev.c b/fs/char_dev.c index 038674a..f4c371a 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -199,7 +199,10 @@ int register_chrdev_region(dev_t from, unsigned count, const char *name) struct char_device_struct *cd; dev_t to = from + count; dev_t n, next; - + + if(unlikely(count == 0)) + return -EINVAL; + for (n = from; n < to; n = next) { next = MKDEV(MAJOR(n)+1, 0); if (next > to) -- -- Anubhav Rakshit -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html