From: "Hans J. Koch" <hjk@hansjkoch.de>
To: Hillf Danton <dhillf@gmail.com>
Cc: Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] uio: fix allocating minor id for uio device
Date: Mon, 28 Mar 2011 23:45:05 +0200 [thread overview]
Message-ID: <20110328214504.GC2786@local> (raw)
In-Reply-To: <AANLkTikKNOPi1ALD0vWiwPKDzUJSseuis63qYJKYkj6=@mail.gmail.com>
On Sun, Mar 27, 2011 at 04:00:39PM +0800, Hillf Danton wrote:
(Added Greg KH to Cc:)
> The number of uio devices that could be used should be less than
> UIO_MAX_DEVICES by design,
> and this work guards any cases in which id more than UIO_MAX_DEVICES
> is utilized.
>
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
>
> --- a/drivers/uio/uio.c 2011-01-05 08:50:20.000000000 +0800
> +++ b/drivers/uio/uio.c 2011-03-27 15:05:26.000000000 +0800
> @@ -381,7 +381,13 @@ static int uio_get_minor(struct uio_devi
> retval = -ENOMEM;
> goto exit;
> }
> - idev->minor = id & MAX_ID_MASK;
> + if (id < UIO_MAX_DEVICES)
> + idev->minor = id;
> + else {
> + printk(KERN_ERR "uio: too many uio devices\n");
No printk(), please. Use dev_err().
Otherwise, it looks good to me.
Thanks,
Hans
> + retval = -EINVAL;
> + idr_remove(&uio_idr, id);
> + }
> exit:
> mutex_unlock(&minor_lock);
> return retval;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
next prev parent reply other threads:[~2011-03-28 21:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-27 8:00 [PATCH] uio: fix allocating minor id for uio device Hillf Danton
2011-03-28 21:45 ` Hans J. Koch [this message]
2011-03-29 8:40 ` Wolfram Sang
2011-03-31 12:38 ` Hillf Danton
2011-03-31 17:55 ` Hans J. Koch
-- strict thread matches above, loose matches on Subject: below --
2011-03-27 7:22 zhdxzx
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110328214504.GC2786@local \
--to=hjk@hansjkoch.de \
--cc=dhillf@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.