summaryrefslogtreecommitdiff
path: root/sound/firewire/oxfw/oxfw-pcm.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-12-12 22:27:03 +0300
committerTakashi Iwai <tiwai@suse.de>2014-12-15 12:03:21 +0300
commit5580ba7bf61a6047a8b95459a9ed893f01947737 (patch)
tree2e43097b2912444d3a42803058a4eb93c7f69823 /sound/firewire/oxfw/oxfw-pcm.c
parent0d3aba30b755fe9ccaf390f0e71f6fb9fd55bd87 (diff)
downloadlinux-5580ba7bf61a6047a8b95459a9ed893f01947737.tar.xz
ALSA: oxfw: some signedness bugs
This code tends to use unsigned variables by default and it causes signedness bugs when we use negative variables for error handling. The "i" and "j" variables are used to iterated over small positive values and so they should be type "int". The "len" variable doesn't *need* to be signed but it should be signed to make the code easier to read and audit. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/oxfw/oxfw-pcm.c')
-rw-r--r--sound/firewire/oxfw/oxfw-pcm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/firewire/oxfw/oxfw-pcm.c b/sound/firewire/oxfw/oxfw-pcm.c
index 9bc556b15a92..67ade0775a5b 100644
--- a/sound/firewire/oxfw/oxfw-pcm.c
+++ b/sound/firewire/oxfw/oxfw-pcm.c
@@ -19,7 +19,7 @@ static int hw_rule_rate(struct snd_pcm_hw_params *params,
.min = UINT_MAX, .max = 0, .integer = 1
};
struct snd_oxfw_stream_formation formation;
- unsigned int i, err;
+ int i, err;
for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
if (formats[i] == NULL)
@@ -47,7 +47,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params,
const struct snd_interval *r =
hw_param_interval_c(params, SNDRV_PCM_HW_PARAM_RATE);
struct snd_oxfw_stream_formation formation;
- unsigned int i, j, err;
+ int i, j, err;
unsigned int count, list[SND_OXFW_STREAM_FORMAT_ENTRIES] = {0};
count = 0;
@@ -80,7 +80,7 @@ static int hw_rule_channels(struct snd_pcm_hw_params *params,
static void limit_channels_and_rates(struct snd_pcm_hardware *hw, u8 **formats)
{
struct snd_oxfw_stream_formation formation;
- unsigned int i, err;
+ int i, err;
hw->channels_min = UINT_MAX;
hw->channels_max = 0;