diff mbox

[v2] ALSA: firewire-tascam: off by one in identify_model()

Message ID 20151019112927.GA31691@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Oct. 19, 2015, 11:29 a.m. UTC
Let's leave space for the NUL char otherwise the static checkers
complain that we go beyond the end of the array.

Fixes: 53b3ffee7885 ('ALSA: firewire-tascam: change device probing processing') 
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: I truncated the last char in v1 instead of making the buffer larger

Comments

Takashi Sakamoto Oct. 19, 2015, 11:54 a.m. UTC | #1
On Oct 19 2015 20:29, Dan Carpenter wrote:
> Let's leave space for the NUL char otherwise the static checkers
> complain that we go beyond the end of the array.
> 
> Fixes: 53b3ffee7885 ('ALSA: firewire-tascam: change device probing processing') 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>


Thank you to fix it.

Takashi Sakamoto

> ---
> v2: I truncated the last char in v1 instead of making the buffer larger
> 
> diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
> index c6747a4..79cb9e9 100644
> --- a/sound/firewire/tascam/tascam.c
> +++ b/sound/firewire/tascam/tascam.c
> @@ -40,7 +40,7 @@ static int identify_model(struct snd_tscm *tscm)
>  {
>  	struct fw_device *fw_dev = fw_parent_device(tscm->unit);
>  	const u32 *config_rom = fw_dev->config_rom;
> -	char model[8];
> +	char model[9];
>  	unsigned int i;
>  	u8 c;
>  
>
Takashi Iwai Oct. 19, 2015, 12:01 p.m. UTC | #2
On Mon, 19 Oct 2015 13:29:27 +0200,
Dan Carpenter wrote:
> 
> Let's leave space for the NUL char otherwise the static checkers
> complain that we go beyond the end of the array.
> 
> Fixes: 53b3ffee7885 ('ALSA: firewire-tascam: change device probing processing') 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: I truncated the last char in v1 instead of making the buffer larger

Applied, thanks.


Takashi

> 
> diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
> index c6747a4..79cb9e9 100644
> --- a/sound/firewire/tascam/tascam.c
> +++ b/sound/firewire/tascam/tascam.c
> @@ -40,7 +40,7 @@ static int identify_model(struct snd_tscm *tscm)
>  {
>  	struct fw_device *fw_dev = fw_parent_device(tscm->unit);
>  	const u32 *config_rom = fw_dev->config_rom;
> -	char model[8];
> +	char model[9];
>  	unsigned int i;
>  	u8 c;
>  
>
diff mbox

Patch

diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
index c6747a4..79cb9e9 100644
--- a/sound/firewire/tascam/tascam.c
+++ b/sound/firewire/tascam/tascam.c
@@ -40,7 +40,7 @@  static int identify_model(struct snd_tscm *tscm)
 {
 	struct fw_device *fw_dev = fw_parent_device(tscm->unit);
 	const u32 *config_rom = fw_dev->config_rom;
-	char model[8];
+	char model[9];
 	unsigned int i;
 	u8 c;