diff options
author | Dan Carpenter <error27@gmail.com> | 2010-10-15 16:36:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-15 18:42:26 -0400 |
commit | 9f407840bb888e683fa844b1b80eec54ced84653 (patch) | |
tree | 83acf0ce385a9df5733d5a1fd5b7cbdbc298233a | |
parent | 87b554a04a0d12f8ff3612b6c2e163e29a34616a (diff) |
Staging: intel_sst: off by one bug
This should be >= instead of > or we go passed the end of the array.
Also the arrays are declared with size MAX_NUM_STREAMS. This is the
only place that uses MAX_NUM_STREAMS_MFLD. It seems like asking for
trouble to use two variables for the same information. I've changed
everything to use MAX_NUM_STREAMS.
This bug isn't really harmful. In the worst case, if you enabled
debugging then you would see a message.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/intel_sst/intel_sst_fw_ipc.h | 1 | ||||
-rw-r--r-- | drivers/staging/intel_sst/intel_sst_stream.c | 2 |
2 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/intel_sst/intel_sst_fw_ipc.h b/drivers/staging/intel_sst/intel_sst_fw_ipc.h index 1a2f67f0aedc..9d3c36807e07 100644 --- a/drivers/staging/intel_sst/intel_sst_fw_ipc.h +++ b/drivers/staging/intel_sst/intel_sst_fw_ipc.h | |||
@@ -31,7 +31,6 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #define MAX_NUM_STREAMS_MRST 3 | 33 | #define MAX_NUM_STREAMS_MRST 3 |
34 | #define MAX_NUM_STREAMS_MFLD 6 | ||
35 | #define MAX_NUM_STREAMS 6 | 34 | #define MAX_NUM_STREAMS 6 |
36 | #define MAX_DBG_RW_BYTES 80 | 35 | #define MAX_DBG_RW_BYTES 80 |
37 | #define MAX_NUM_SCATTER_BUFFERS 8 | 36 | #define MAX_NUM_SCATTER_BUFFERS 8 |
diff --git a/drivers/staging/intel_sst/intel_sst_stream.c b/drivers/staging/intel_sst/intel_sst_stream.c index 1ce3a9c4e3d5..b2c4b7067da0 100644 --- a/drivers/staging/intel_sst/intel_sst_stream.c +++ b/drivers/staging/intel_sst/intel_sst_stream.c | |||
@@ -45,7 +45,7 @@ | |||
45 | */ | 45 | */ |
46 | int sst_check_device_type(u32 device, u32 num_chan, u32 *pcm_slot) | 46 | int sst_check_device_type(u32 device, u32 num_chan, u32 *pcm_slot) |
47 | { | 47 | { |
48 | if (device > MAX_NUM_STREAMS_MFLD) { | 48 | if (device >= MAX_NUM_STREAMS) { |
49 | pr_debug("sst: device type invalid %d\n", device); | 49 | pr_debug("sst: device type invalid %d\n", device); |
50 | return -EINVAL; | 50 | return -EINVAL; |
51 | } | 51 | } |