From patchwork Wed Jul 29 13:35:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roel Kluin X-Patchwork-Id: 38148 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 n6TDWkSa019268 for ; Wed, 29 Jul 2009 13:32:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754650AbZG2Ncn (ORCPT ); Wed, 29 Jul 2009 09:32:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754684AbZG2Ncn (ORCPT ); Wed, 29 Jul 2009 09:32:43 -0400 Received: from ey-out-2122.google.com ([74.125.78.24]:51768 "EHLO ey-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754650AbZG2Ncn (ORCPT ); Wed, 29 Jul 2009 09:32:43 -0400 Received: by ey-out-2122.google.com with SMTP id 9so198810eyd.37 for ; Wed, 29 Jul 2009 06:32:42 -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=uIgHiXj0k8Pmkixo8Y7XlQYVpSw+M2sNkHjxk3seWHA=; b=FWnY/vUTxESX24B69VDYOMyTcOcYEm1iN1C7xOegfCx8+SNWThHHmdpUZEIJ0Ld94g 6o26MYxzL8U8SoJDGuHotZpfV8HM4ygWYxgBIN0AOdE1D6BejfW5CKuiPUTIkEuemxpw VA3yJ8c+tKy43cjR7/xbBa/o2aCPPLc+/tKoM= 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=MnBy6+md2fniD6TqjYLYwKt7kOv0ULU2ppCSsY1o/iqAKsoQQcztHpFA+K4xjelUUP y6kz0z2ZnPE7K4RFeuP6hCNOcAlJfM84AY5r19RfQNrtKjxFO2Kp/ZTwcy5TDUnzvdp/ 3AsgK/2mAR0FICgdWCqUr+2h3hkdMLADtugpA= Received: by 10.216.29.72 with SMTP id h50mr2279595wea.137.1248874362809; Wed, 29 Jul 2009 06:32:42 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 10sm901494eyd.17.2009.07.29.06.32.41 (version=SSLv3 cipher=RC4-MD5); Wed, 29 Jul 2009 06:32:42 -0700 (PDT) Message-ID: <4A705028.80008@gmail.com> Date: Wed, 29 Jul 2009 15:35:36 +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: awalls@radix.net, ivtv-devel@ivtvdriver.org, linux-media@vger.kernel.org, Andrew Morton Subject: [PATCH] cx18: Read buffer overflow Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The guard mistakenly tests against sizeof(freqs) instead of ARRAY_SIZE(freqs). Signed-off-by: Roel Kluin --- Andy Walls wrote: > The cx18 driver suffers from the exact same defect in cx18-controls.c. Thanks, if not already applied, here is it. -- 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; }