From patchwork Thu Nov 7 21:13:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 3154541 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 782329F3C4 for ; Thu, 7 Nov 2013 21:14:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5428B2047C for ; Thu, 7 Nov 2013 21:14:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7083A202C8 for ; Thu, 7 Nov 2013 21:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752763Ab3KGVOk (ORCPT ); Thu, 7 Nov 2013 16:14:40 -0500 Received: from mailout2.w2.samsung.com ([211.189.100.12]:63272 "EHLO usmailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750939Ab3KGVOj (ORCPT ); Thu, 7 Nov 2013 16:14:39 -0500 Received: from uscpsbgm2.samsung.com (u115.gpu85.samsung.co.kr [203.254.195.115]) by mailout2.w2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MVW0020BWCA9G00@mailout2.w2.samsung.com> for linux-media@vger.kernel.org; Thu, 07 Nov 2013 16:14:38 -0500 (EST) X-AuditID: cbfec373-b7f6d6d00000330d-0c-527c02be3ef0 Received: from ussync1.samsung.com ( [203.254.195.81]) by uscpsbgm2.samsung.com (USCPMTA) with SMTP id 02.A3.13069.EB20C725; Thu, 07 Nov 2013 16:14:38 -0500 (EST) Received: from localhost.localdomain ([105.144.34.10]) by ussync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MVW00BOIWC9O260@ussync1.samsung.com>; Thu, 07 Nov 2013 16:14:38 -0500 (EST) Date: Thu, 07 Nov 2013 19:13:45 -0200 From: Mauro Carvalho Chehab To: Antti Palosaari Cc: Andy Walls , Linux Media Mailing List , Mauro Carvalho Chehab Subject: Re: [PATCH v3 18/29] [media] tuners: Don't use dynamic static allocation Message-id: <20131107191345.27ab51df@samsung.com> In-reply-to: <527BE215.4080702@iki.fi> References: <1383645702-30636-1-git-send-email-m.chehab@samsung.com> <1383645702-30636-19-git-send-email-m.chehab@samsung.com> <527926CB.8070006@iki.fi> <527BE215.4080702@iki.fi> X-Mailer: Claws Mail 3.9.2 (GTK+ 2.24.22; x86_64-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOLMWRmVeSWpSXmKPExsVy+t/hQN19TDVBBlPX8lm8aU+y+N78ns2i Z8NWVosdpxYxO7B4HP66kMVj8wotj1kXNrN7fN4kF8ASxWWTkpqTWZZapG+XwJUxYcNuloLL phVvvzQwNTB+0+pi5OCQEDCR2Hdft4uRE8gUk7hwbz1bFyMXh5DAEkaJpYc3s4IkhAR6mCR+ Tg0GsVkEVCWubpjHBGKzCRhJvGpsAasREVCSWLBhJxNIM7PAZEaJo2s+MIMkhAWCJXbN3Qxm 8woYSry9fJcFxOYUUJPo3feAFWLbNkaJxY+WsUNc5CSx+4AURL2gxI/J98DqmQW0JDZva2KF sOUlNq95yzyBUWAWkrJZSMpmISlbwMi8ilG0tDi5oDgpPddIrzgxt7g0L10vOT93EyMkcIt3 ML7YYHWIUYCDUYmHt+BCdZAQa2JZcWXuIUYJDmYlEd6934FCvCmJlVWpRfnxRaU5qcWHGJk4 OKUaGCWU9iUebGQollO12rAsueaXzB/VX/Lhe4qmXp52S2hPo0emwIGzqoo/D76ZUvSdwzdo L9OtDU9eHCu/7P9dUnXl7d+OnmaHYwTmzDPzq5rzxTDsv0bf29tb78+0OvPetGWxoXzD/rK5 URXlYmXz3fW4ZylwbH5o+e5Ly195/n9OppPe8Hd2b1NiKc5INNRiLipOBABBBlIGOgIAAA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Em Thu, 07 Nov 2013 20:55:17 +0200 Antti Palosaari escreveu: > Mauro, > I just notified these are all broken. The reason is here that I2C > adapter sets I2C operation length using sizeof(buf). Gah! > Please take a look of all there patches and check existing use of > sizeof(buf). Thanks for review! Well not all were broken, as, on most drivers weren't using sizeof(). Anyway, I double-checked everything and fixed the drivers. Instead of just mailbombing a 29 patch series, it seems better to just paste here the differences from v4, and add a pointer to a git tree with the full series of patches: http://git.linuxtv.org/mchehab/experimental.git/shortlog/refs/heads/build-fixes-v4 Enclosed is the diff against v3. PS.: it also addresses the issue pointed by Andy. Regards, Mauro - Cheers, Mauro Reviewed-by: Antti Palosaari --- 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/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c index 19ba66ad23fa..fb504f1e9125 100644 --- a/drivers/media/dvb-frontends/af9013.c +++ b/drivers/media/dvb-frontends/af9013.c @@ -58,7 +58,7 @@ static int af9013_wr_regs_i2c(struct af9013_state *priv, u8 mbox, u16 reg, { .addr = priv->config.i2c_addr, .flags = 0, - .len = sizeof(buf), + .len = 3 + len, .buf = buf, } }; diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index 11f1555e66dc..30ee59052157 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c @@ -48,7 +48,7 @@ static int af9033_wr_regs(struct af9033_state *state, u32 reg, const u8 *val, { .addr = state->cfg.i2c_addr, .flags = 0, - .len = sizeof(buf), + .len = 3 + len, .buf = buf, } }; diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c index b908800b390d..7efb796c472c 100644 --- a/drivers/media/dvb-frontends/rtl2830.c +++ b/drivers/media/dvb-frontends/rtl2830.c @@ -39,7 +39,7 @@ static int rtl2830_wr(struct rtl2830_priv *priv, u8 reg, const u8 *val, int len) { .addr = priv->cfg.i2c_addr, .flags = 0, - .len = 1+len, + .len = 1 + len, .buf = buf, } }; diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index cd1e6965ac11..ff73da9365e3 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -170,7 +170,7 @@ static int rtl2832_wr(struct rtl2832_priv *priv, u8 reg, u8 *val, int len) { .addr = priv->cfg.i2c_addr, .flags = 0, - .len = 1+len, + .len = 1 + len, .buf = buf, } }; diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c index 97c400a4297f..93eeaf7118fd 100644 --- a/drivers/media/dvb-frontends/s5h1420.c +++ b/drivers/media/dvb-frontends/s5h1420.c @@ -854,7 +854,7 @@ static int s5h1420_tuner_i2c_tuner_xfer(struct i2c_adapter *i2c_adap, struct i2c memcpy(&m[1], msg, sizeof(struct i2c_msg) * num); - return i2c_transfer(state->i2c, m, 1+num) == 1 + num ? num : -EIO; + return i2c_transfer(state->i2c, m, 1 + num) == 1 + num ? num : -EIO; } static struct i2c_algorithm s5h1420_tuner_i2c_algo = { diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c index 1d8bc2ea4b10..8ad3a57cf640 100644 --- a/drivers/media/dvb-frontends/tda10071.c +++ b/drivers/media/dvb-frontends/tda10071.c @@ -35,7 +35,7 @@ static int tda10071_wr_regs(struct tda10071_priv *priv, u8 reg, u8 *val, { .addr = priv->cfg.demod_i2c_addr, .flags = 0, - .len = sizeof(buf), + .len = 1 + len, .buf = buf, } }; @@ -76,7 +76,7 @@ static int tda10071_rd_regs(struct tda10071_priv *priv, u8 reg, u8 *val, }, { .addr = priv->cfg.demod_i2c_addr, .flags = I2C_M_RD, - .len = sizeof(buf), + .len = len, .buf = buf, } }; diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 87f5bcf29e90..c1f8cc6f14b2 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c @@ -327,7 +327,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) struct i2c_client *c; u8 eedata[256]; - c = kzalloc(sizeof(*c), GFP_ATOMIC); + c = kzalloc(sizeof(*c), GFP_KERNEL); strlcpy(c->name, "cx18 tveeprom tmp", sizeof(c->name)); c->adapter = &cx->i2c_adap[0]; diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c index 30192463c9e1..c9cc1232f2e5 100644 --- a/drivers/media/tuners/e4000.c +++ b/drivers/media/tuners/e4000.c @@ -32,7 +32,7 @@ static int e4000_wr_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) { .addr = priv->cfg->i2c_addr, .flags = 0, - .len = sizeof(buf), + .len = 1 + len, .buf = buf, } }; @@ -73,7 +73,7 @@ static int e4000_rd_regs(struct e4000_priv *priv, u8 reg, u8 *val, int len) }, { .addr = priv->cfg->i2c_addr, .flags = I2C_M_RD, - .len = sizeof(buf), + .len = len, .buf = buf, } }; diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c index 430fa5163ec7..3aecaf465094 100644 --- a/drivers/media/tuners/fc2580.c +++ b/drivers/media/tuners/fc2580.c @@ -49,7 +49,7 @@ static int fc2580_wr_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) { .addr = priv->cfg->i2c_addr, .flags = 0, - .len = sizeof(buf), + .len = 1 + len, .buf = buf, } }; @@ -89,7 +89,7 @@ static int fc2580_rd_regs(struct fc2580_priv *priv, u8 reg, u8 *val, int len) }, { .addr = priv->cfg->i2c_addr, .flags = I2C_M_RD, - .len = sizeof(buf), + .len = len, .buf = buf, } }; diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c index b3a4adf9ff8f..abe256e1f843 100644 --- a/drivers/media/tuners/tda18212.c +++ b/drivers/media/tuners/tda18212.c @@ -40,7 +40,7 @@ static int tda18212_wr_regs(struct tda18212_priv *priv, u8 reg, u8 *val, { .addr = priv->cfg->i2c_address, .flags = 0, - .len = sizeof(buf), + .len = 1 + len, .buf = buf, } }; @@ -81,7 +81,7 @@ static int tda18212_rd_regs(struct tda18212_priv *priv, u8 reg, u8 *val, }, { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, - .len = sizeof(buf), + .len = len, .buf = buf, } }; diff --git a/drivers/media/tuners/tda18218.c b/drivers/media/tuners/tda18218.c index 7e2b32ee5349..9300e9361e3b 100644 --- a/drivers/media/tuners/tda18218.c +++ b/drivers/media/tuners/tda18218.c @@ -83,7 +83,7 @@ static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) }, { .addr = priv->cfg->i2c_address, .flags = I2C_M_RD, - .len = sizeof(buf), + .len = reg + len, .buf = buf, } };