All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ALSA: vx_core: off by one in vx_read_status()
@ 2013-06-21 12:25 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-06-21 12:25 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors

This code is older than git, and I haven't tested it, but if size ==
SIZE_MAX_STATUS then we would write one space past the end of the
rmh->Stat[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index c39961c..8359689 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -205,7 +205,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
 
 	if (size < 1)
 		return 0;
-	if (snd_BUG_ON(size > SIZE_MAX_STATUS))
+	if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
 		return -EINVAL;
 
 	for (i = 1; i <= size; i++) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [patch] ALSA: vx_core: off by one in vx_read_status()
@ 2013-06-21 12:25 ` Dan Carpenter
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2013-06-21 12:25 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, alsa-devel, kernel-janitors

This code is older than git, and I haven't tested it, but if size =
SIZE_MAX_STATUS then we would write one space past the end of the
rmh->Stat[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index c39961c..8359689 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -205,7 +205,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
 
 	if (size < 1)
 		return 0;
-	if (snd_BUG_ON(size > SIZE_MAX_STATUS))
+	if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
 		return -EINVAL;
 
 	for (i = 1; i <= size; i++) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] ALSA: vx_core: off by one in vx_read_status()
  2013-06-21 12:25 ` Dan Carpenter
@ 2013-06-21 12:32   ` Takashi Iwai
  -1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2013-06-21 12:32 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jaroslav Kysela, alsa-devel, kernel-janitors

At Fri, 21 Jun 2013 15:25:33 +0300,
Dan Carpenter wrote:
> 
> This code is older than git, and I haven't tested it, but if size ==
> SIZE_MAX_STATUS then we would write one space past the end of the
> rmh->Stat[] array.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Yes, the patch looks correct.  Applied now.
Thanks.


Takashi


> diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
> index c39961c..8359689 100644
> --- a/sound/drivers/vx/vx_core.c
> +++ b/sound/drivers/vx/vx_core.c
> @@ -205,7 +205,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
>  
>  	if (size < 1)
>  		return 0;
> -	if (snd_BUG_ON(size > SIZE_MAX_STATUS))
> +	if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
>  		return -EINVAL;
>  
>  	for (i = 1; i <= size; i++) {
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] ALSA: vx_core: off by one in vx_read_status()
@ 2013-06-21 12:32   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2013-06-21 12:32 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jaroslav Kysela, alsa-devel, kernel-janitors

At Fri, 21 Jun 2013 15:25:33 +0300,
Dan Carpenter wrote:
> 
> This code is older than git, and I haven't tested it, but if size =
> SIZE_MAX_STATUS then we would write one space past the end of the
> rmh->Stat[] array.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Yes, the patch looks correct.  Applied now.
Thanks.


Takashi


> diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
> index c39961c..8359689 100644
> --- a/sound/drivers/vx/vx_core.c
> +++ b/sound/drivers/vx/vx_core.c
> @@ -205,7 +205,7 @@ static int vx_read_status(struct vx_core *chip, struct vx_rmh *rmh)
>  
>  	if (size < 1)
>  		return 0;
> -	if (snd_BUG_ON(size > SIZE_MAX_STATUS))
> +	if (snd_BUG_ON(size >= SIZE_MAX_STATUS))
>  		return -EINVAL;
>  
>  	for (i = 1; i <= size; i++) {
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-21 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21 12:25 [patch] ALSA: vx_core: off by one in vx_read_status() Dan Carpenter
2013-06-21 12:25 ` Dan Carpenter
2013-06-21 12:32 ` Takashi Iwai
2013-06-21 12:32   ` Takashi Iwai

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.