From patchwork Sun Mar 21 14:02:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Castet X-Patchwork-Id: 87254 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2LE34mw031220 for ; Sun, 21 Mar 2010 14:03:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101Ab0CUODB (ORCPT ); Sun, 21 Mar 2010 10:03:01 -0400 Received: from smtp2-g21.free.fr ([212.27.42.2]:48920 "EHLO smtp2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752983Ab0CUODA (ORCPT ); Sun, 21 Mar 2010 10:03:00 -0400 Received: from smtp2-g21.free.fr (localhost [127.0.0.1]) by smtp2-g21.free.fr (Postfix) with ESMTP id 831964B0150; Sun, 21 Mar 2010 15:02:53 +0100 (CET) Received: from [192.168.1.234] (cac94-1-81-57-151-96.fbx.proxad.net [81.57.151.96]) by smtp2-g21.free.fr (Postfix) with ESMTP id 4C0FA4B00E6; Sun, 21 Mar 2010 15:02:51 +0100 (CET) Message-ID: <4BA6270A.4050703@free.fr> Date: Sun, 21 Mar 2010 15:02:50 +0100 From: matthieu castet User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.1.23) Gecko/20090823 SeaMonkey/1.1.18 MIME-Version: 1.0 To: linux-media@vger.kernel.org, linux-i2c@vger.kernel.org Subject: i2c interface bugs in dvb drivers Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 21 Mar 2010 14:03:04 +0000 (UTC) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 3202a86..91e63ea 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1150,6 +1150,17 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) (msgs[ret].flags & I2C_M_RECV_LEN) ? "+" : ""); } #endif + for (ret = 0; ret < num; ret++) { + if (msgs[ret].flags & I2C_M_TEN) { + /* XXX what"s I2C_M_TEN range */ + if (msgs[ret].addr < 0x03 || msgs[ret].addr > 0x377) + return -EINVAL; + } + else { + if (msgs[ret].addr < 0x03 || msgs[ret].addr > 0x77) + return -EINVAL; + } + } if (in_atomic() || irqs_disabled()) { ret = rt_mutex_trylock(&adap->bus_lock);