From: Clemens Ladisch <clemens@ladisch.de>
To: Dan Carpenter <error27@gmail.com>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
kernel-janitors@vger.kernel.org, Kyle McMartin <kyle@mcmartin.ca>,
Ulrich Drepper <drepper@redhat.com>
Subject: Re: [patch] ALSA: rawmidi: cleanup the get next midi device ioctl
Date: Wed, 08 Sep 2010 11:40:16 +0200 [thread overview]
Message-ID: <4C875A00.7030005@ladisch.de> (raw)
In-Reply-To: <20100908085308.GC32047@bicker>
Dan Carpenter wrote:
> I'm doing an audit to find integer overflows and my static checker
> complained that in the original code "device + 1" could overflow. The
> overflow is harmless, but it's still worth cleaning up. The other thing
> that I noticed is that if you pass in a device which is higher than
> SNDRV_RAWMIDI_DEVICES then it doesn't return an error code but just
> tells you that the next device is "device + 1".
>
> I have rewritten it to just return -EINVAL if you pass in a bogus value
> that's either too high or too low.
A negative value is a valid input.
> + if (device > SNDRV_RAWMIDI_DEVICES)
> + return -EINVAL;
if (device >= SNDRV_RAWMIDI_DEVICES)
Regards,
Clemens
WARNING: multiple messages have this Message-ID (diff)
From: Clemens Ladisch <clemens@ladisch.de>
To: Dan Carpenter <error27@gmail.com>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
kernel-janitors@vger.kernel.org, Kyle McMartin <kyle@mcmartin.ca>,
Ulrich Drepper <drepper@redhat.com>
Subject: Re: [patch] ALSA: rawmidi: cleanup the get next midi device ioctl
Date: Wed, 08 Sep 2010 09:40:16 +0000 [thread overview]
Message-ID: <4C875A00.7030005@ladisch.de> (raw)
In-Reply-To: <20100908085308.GC32047@bicker>
Dan Carpenter wrote:
> I'm doing an audit to find integer overflows and my static checker
> complained that in the original code "device + 1" could overflow. The
> overflow is harmless, but it's still worth cleaning up. The other thing
> that I noticed is that if you pass in a device which is higher than
> SNDRV_RAWMIDI_DEVICES then it doesn't return an error code but just
> tells you that the next device is "device + 1".
>
> I have rewritten it to just return -EINVAL if you pass in a bogus value
> that's either too high or too low.
A negative value is a valid input.
> + if (device > SNDRV_RAWMIDI_DEVICES)
> + return -EINVAL;
if (device >= SNDRV_RAWMIDI_DEVICES)
Regards,
Clemens
next prev parent reply other threads:[~2010-09-08 9:39 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-08 8:53 [patch] ALSA: rawmidi: cleanup the get next midi device ioctl Dan Carpenter
2010-09-08 8:53 ` Dan Carpenter
2010-09-08 9:40 ` Clemens Ladisch [this message]
2010-09-08 9:40 ` Clemens Ladisch
2010-09-08 19:36 ` [patch v2] ALSA: rawmidi: fix " Dan Carpenter
2010-09-08 19:36 ` Dan Carpenter
2010-09-08 19:56 ` Takashi Iwai
2010-09-08 19:56 ` Takashi Iwai
2010-09-08 21:29 ` Jaroslav Kysela
2010-09-08 21:29 ` Jaroslav Kysela
2010-09-08 22:11 ` [patch v3] " Dan Carpenter
2010-09-08 22:11 ` Dan Carpenter
2010-09-09 7:07 ` Takashi Iwai
2010-09-09 7:07 ` Takashi Iwai
2010-09-09 8:36 ` Jaroslav Kysela
2010-09-09 8:36 ` Jaroslav Kysela
2010-09-09 7:23 ` walter harms
2010-09-09 7:23 ` walter harms
2010-09-09 6:57 ` [patch v2] " Takashi Iwai
2010-09-09 6:57 ` Takashi Iwai
2010-09-09 7:44 ` Clemens Ladisch
2010-09-09 7:44 ` Clemens Ladisch
2010-09-09 8:46 ` Dan Carpenter
2010-09-09 8:46 ` Dan Carpenter
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=4C875A00.7030005@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=drepper@redhat.com \
--cc=error27@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kyle@mcmartin.ca \
--cc=tiwai@suse.de \
/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.