* [PATCH] ivtv: Read buffer overflow
@ 2009-07-23 21:31 Roel Kluin
2009-07-24 0:36 ` Andy Walls
0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-07-23 21:31 UTC (permalink / raw)
To: hverkuil, ivtv-devel, linux-media, Andrew Morton
This mistakenly tests against sizeof(freqs) instead of the array size. Due to
the mask the only illegal value possible was 3.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c
index a3b77ed..4a9c8ce 100644
--- a/drivers/media/video/ivtv/ivtv-controls.c
+++ b/drivers/media/video/ivtv/ivtv-controls.c
@@ -17,6 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <linux/kernel.h>
#include "ivtv-driver.h"
#include "ivtv-cards.h"
@@ -281,7 +282,7 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
idx = p.audio_properties & 0x03;
/* The audio clock of the digitizer must match the codec sample
rate otherwise you get some very strange effects. */
- if (idx < sizeof(freqs))
+ if (idx < ARRAY_SIZE(freqs))
ivtv_call_all(itv, audio, s_clock_freq, freqs[idx]);
return err;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ivtv: Read buffer overflow
2009-07-23 21:31 [PATCH] ivtv: Read buffer overflow Roel Kluin
@ 2009-07-24 0:36 ` Andy Walls
0 siblings, 0 replies; 2+ messages in thread
From: Andy Walls @ 2009-07-24 0:36 UTC (permalink / raw)
To: Roel Kluin; +Cc: hverkuil, ivtv-devel, linux-media, Andrew Morton
On Thu, 2009-07-23 at 23:31 +0200, Roel Kluin wrote:
> This mistakenly tests against sizeof(freqs) instead of the array size. Due to
> the mask the only illegal value possible was 3.
>
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Andy Walls <awalls@radix.net>
The cx18 driver suffers from the exact same defect in cx18-controls.c.
> ---
> diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c
> index a3b77ed..4a9c8ce 100644
> --- a/drivers/media/video/ivtv/ivtv-controls.c
> +++ b/drivers/media/video/ivtv/ivtv-controls.c
> @@ -17,6 +17,7 @@
> along with this program; if not, write to the Free Software
> Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> */
> +#include <linux/kernel.h>
>
> #include "ivtv-driver.h"
> #include "ivtv-cards.h"
> @@ -281,7 +282,7 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
> idx = p.audio_properties & 0x03;
> /* The audio clock of the digitizer must match the codec sample
> rate otherwise you get some very strange effects. */
> - if (idx < sizeof(freqs))
> + if (idx < ARRAY_SIZE(freqs))
> ivtv_call_all(itv, audio, s_clock_freq, freqs[idx]);
> return err;
> }
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-24 0:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-23 21:31 [PATCH] ivtv: Read buffer overflow Roel Kluin
2009-07-24 0:36 ` Andy Walls
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox