All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: Takashi Iwai <tiwai@suse.de>,
	kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org,
	Clemens Ladisch <clemens@ladisch.de>
Subject: Re: [patch 1/2] ALSA: oxfw: some signedness bugs
Date: Sat, 13 Dec 2014 14:38:52 +0300	[thread overview]
Message-ID: <20141213113852.GB4911@mwanda> (raw)
In-Reply-To: <548C1196.4010503@sakamocchi.jp>

Think about a for loop:

	for (i = 0; i < xxx; i++) {

If "i" is really so high that it goes negative you have a very serious
issue whether it's signed or unsigned.  If it's signed then the loop is
a no-op but if it's unsigned then it corrupts memory.

That's not a win.

regards,
dan carpenter


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: Takashi Iwai <tiwai@suse.de>,
	kernel-janitors@vger.kernel.org, alsa-devel@alsa-project.org,
	Clemens Ladisch <clemens@ladisch.de>
Subject: Re: [patch 1/2] ALSA: oxfw: some signedness bugs
Date: Sat, 13 Dec 2014 11:38:52 +0000	[thread overview]
Message-ID: <20141213113852.GB4911@mwanda> (raw)
In-Reply-To: <548C1196.4010503@sakamocchi.jp>

Think about a for loop:

	for (i = 0; i < xxx; i++) {

If "i" is really so high that it goes negative you have a very serious
issue whether it's signed or unsigned.  If it's signed then the loop is
a no-op but if it's unsigned then it corrupts memory.

That's not a win.

regards,
dan carpenter


  parent reply	other threads:[~2014-12-13 11:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 19:27 [patch 1/2] ALSA: oxfw: some signedness bugs Dan Carpenter
2014-12-12 19:27 ` Dan Carpenter
2014-12-13  5:06 ` Takashi Sakamoto
2014-12-13  5:06   ` Takashi Sakamoto
2014-12-13  7:04   ` Dan Carpenter
2014-12-13  7:04     ` Dan Carpenter
2014-12-13 10:14     ` Takashi Sakamoto
2014-12-13 10:14       ` Takashi Sakamoto
2014-12-13 11:35       ` Dan Carpenter
2014-12-13 11:35         ` Dan Carpenter
2014-12-13 11:38       ` Dan Carpenter [this message]
2014-12-13 11:38         ` Dan Carpenter
2014-12-13 17:30       ` Takashi Iwai
2014-12-13 17:30         ` Takashi Iwai
2014-12-14 17:01         ` Takashi Sakamoto
2014-12-14 17:01           ` Takashi Sakamoto
2014-12-15  9:03           ` Takashi Iwai
2014-12-15  9:03             ` Takashi Iwai

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=20141213113852.GB4911@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --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.