alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Jaroslav Kysela <perex@perex.cz>
Cc: alsa-devel@alsa-project.org
Subject: bug report: aloop: potential signedness bug in loopback_prepare()
Date: Sat, 9 Oct 2010 13:42:18 +0200	[thread overview]
Message-ID: <20101009114218.GQ11681@bicker> (raw)

Hi Jaroslav,

sound/drivers/aloop.c +287 loopback_prepare(10)
	warn: bogus compare against zero: 'bps'
   282          unsigned int bps, salign;
   283
   284          salign = (snd_pcm_format_width(runtime->format) *
   285							runtime->channels) / 8;
   286          bps = salign * runtime->rate;
   287          if (bps <= 0 || salign <= 0)
                    ^^^^^^^^^^^^^^^^^^^^^^^

	Both "bps" and "salign" are unsigned and are never less than
	zero.  Should this just be checking for == 0?  Or was the check
	supposed to catch integer overflows?

   288                  return -EINVAL;
   289

regards,
dan carpenter

             reply	other threads:[~2010-10-09 11:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-09 11:42 Dan Carpenter [this message]
2010-10-09 12:14 ` bug report: aloop: potential signedness bug in loopback_prepare() Jaroslav Kysela
2010-10-09 14:58   ` 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=20101009114218.GQ11681@bicker \
    --to=error27@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    /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;
as well as URLs for NNTP newsgroup(s).