From patchwork Thu Jul 23 21:31:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 37028 X-Patchwork-Delegate: dougsland@redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6NLTRwd009129 for ; Thu, 23 Jul 2009 21:29:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754168AbZGWV2w (ORCPT ); Thu, 23 Jul 2009 17:28:52 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754577AbZGWV2w (ORCPT ); Thu, 23 Jul 2009 17:28:52 -0400 Received: from ey-out-2122.google.com ([74.125.78.24]:12413 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754168AbZGWV2v (ORCPT ); Thu, 23 Jul 2009 17:28:51 -0400 Received: by ey-out-2122.google.com with SMTP id 9so368470eyd.37 for ; Thu, 23 Jul 2009 14:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=EwAsiCQJ3zvcyx6lLfWm5VBoecI9mqntLhqwYwsYHmE=; b=jpW+EltgLwvuB5c4H1/vsWqo7TKnbDLhGFpPcMK1opC1hOTMjgOCONExKd7KjK06iM fjobCsXDZ9wFAn1xYgSQilwfYss71raiIOIqIBadN3IJlpKBiVq1b3Hvhly4c/wD1Rm0 ug4aHa91DywFazo0uuqpBnjN5SdussZ7M43dI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=HWxo9rdrNTQuO3lNWlVsi+4u5gM86vthIHMwqB3n+RGU6UtFnncA+hgMHWwXz4/3Mw 9wm1zZakKQ4MBELEiZVs//mBRiNpx6/2B5X5WG37Qc5lqacapRokV5og1MBIFRRKnYOA jlPCeRJzB+h2Lg/mUb9gBh1z7raZVD+H+3dpA= Received: by 10.210.129.20 with SMTP id b20mr3223473ebd.78.1248384530377; Thu, 23 Jul 2009 14:28:50 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 28sm298688eye.20.2009.07.23.14.28.48 (version=SSLv3 cipher=RC4-MD5); Thu, 23 Jul 2009 14:28:49 -0700 (PDT) Message-ID: <4A68D6A2.1080800@gmail.com> Date: Thu, 23 Jul 2009 23:31:14 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: hverkuil@xs4all.nl, ivtv-devel@ivtvdriver.org, linux-media@vger.kernel.org, Andrew Morton Subject: [PATCH] ivtv: Read buffer overflow Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 Acked-by: Andy Walls --- -- 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 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 #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; }