public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Mack <zonque@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch 1/2 -next] USB: gadget: midi: fix range check in f_midi_out_open()
Date: Tue, 18 Oct 2011 08:27:42 +0000	[thread overview]
Message-ID: <4E9D387E.9090907@gmail.com> (raw)
In-Reply-To: <20111018062436.GL27732@elgon.mountain>

On 18.10.11 08:24, Dan Carpenter wrote:
> ! has higher precedence than>= and since neither 0 nor 1 are greater
> than 8 the condition is always false.

Sure. The call in question actually not more than a sanity check, as 
lower layers will never call this function with an invalid substream number.

Thanks for spotting this.

> Signed-off-by: Dan Carpenter<dan.carpenter@oracle.com>

Acked-by: Daniel Mack <zonque@gmail.com>



>
> diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c
> index 44858dc..ef1bc7a 100644
> --- a/drivers/usb/gadget/f_midi.c
> +++ b/drivers/usb/gadget/f_midi.c
> @@ -644,7 +644,7 @@ static int f_midi_out_open(struct snd_rawmidi_substream *substream)
>   {
>   	struct f_midi *midi = substream->rmidi->private_data;
>
> -	if (!substream->number>= MAX_PORTS)
> +	if (substream->number>= MAX_PORTS)
>   		return -EINVAL;
>
>   	VDBG(midi, "%s()\n", __func__);


      reply	other threads:[~2011-10-18  8:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-18  6:24 [patch 1/2 -next] USB: gadget: midi: fix range check in Dan Carpenter
2011-10-18  8:27 ` Daniel Mack [this message]

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=4E9D387E.9090907@gmail.com \
    --to=zonque@gmail.com \
    --cc=kernel-janitors@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox