Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3921469imu; Mon, 7 Jan 2019 11:58:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/UW79k4urydYRrrXFpMp9u9fpzZig+ovIRKBQnNLdhrRU+e9W6tPK1UDVC4co0OJVVstsw4 X-Received: by 2002:a62:f907:: with SMTP id o7mr63161040pfh.244.1546891139629; Mon, 07 Jan 2019 11:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546891139; cv=none; d=google.com; s=arc-20160816; b=Gx2EIgyhj5Yl+u5SLMZsz9DLzJ6w+W2DdazZIW9khGfjtWHu1S9zwAsxXD3yqUEMb8 p+vm/80AEHm8+U2iOuKxDLSImWrLbZbF2YC9JnuQeZESVsGArG5o51gqZu1hO8YeBVSn 0hyh29cCNXoxG7kNA8Z2IFRGDTomvLHIeLS+JdV13wW1TaMURDlV2FwzYQG7b1eTlnUr i4F0kzCPlCI9W1F4SWhj0ZZTbVfwvtRnkq+m1NpPfi/AMJI3OG2GnRd5AJS63CrjWcX8 KQhNQ36SSmsQHvzmhiwCj+eFmQLWyosP/FWKeTFEGANlBjTH4n+hi15WkN8XKQaotnuF d+MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=mwyvS9cqn7ZB0uWlHM0yyy2cALvoq6rpMi4xORDK6Qg=; b=I+Yi5KrSp8q5FdvC6bPPvdleiRX+wt6kR0LDvJHSlSi+wBbNFb85hNDJhgsrFEJ0MG N608UegxVzBnq1CEjZ1uoIe38gr6p8nNrPRCY86tCqIyib95v2RLSoFLk9byYC3slUzb 0AEK1CAom/um47M2YfW3Uhc2DvP4P5ECPY74Cz8eWHmIkvXdIPK+clFEzvD9Jrk/SQHq R4qHs52P9jz1Jn5UoK5gAh7fjUMMpr+CyM9UeL02k2jmcW9KQBhhMYHowbVaHt+ziUL0 pq+I4NfG+m+hvJQZElgwXVeXAGTylQuzn91TpBs+KvNZ3MF60xTLCXgrcJRQg+drB19C OkQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=Lx4SnL7I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u131si2101754pgc.287.2019.01.07.11.58.44; Mon, 07 Jan 2019 11:58:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=Lx4SnL7I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727721AbfAGTWu (ORCPT + 99 others); Mon, 7 Jan 2019 14:22:50 -0500 Received: from casper.infradead.org ([85.118.1.10]:53060 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727064AbfAGTWt (ORCPT ); Mon, 7 Jan 2019 14:22:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mwyvS9cqn7ZB0uWlHM0yyy2cALvoq6rpMi4xORDK6Qg=; b=Lx4SnL7IX5fTfVVePhaL71km6R u8m5rav4apiQj7APLkmFPbpEyK1j6FCLixk5fnCtPBqArUbfXZFRA5aacvofYozb5j3GnyW7+OXyN pJ7TA3zVTA++yGpXl4ZOosTw6X/ueNGodlOSIT91HyKTSLbdywV3dq+I1tcxNNsXhPnqL0qRUmvhZ tVIC1p7+yh9VPLz1a1MEWqMWA/arFCJkraXTQ+pDlcFGOR0M9yI1zyhHAgf1LI2TIDqLrn3Mf0aQM 0dt4Ed7UYNsY7f0c2uuZH6MZMqPBkzHNPOUjWg0TH6m+qIhw21jEzC707yMx/npeUHx9gFMsZJW2+ uUx3K0Gg==; Received: from 177.41.113.230.dynamic.adsl.gvt.net.br ([177.41.113.230] helo=coco.lan) by casper.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ggaTr-00023B-Kq; Mon, 07 Jan 2019 19:22:36 +0000 Date: Mon, 7 Jan 2019 17:22:31 -0200 From: Mauro Carvalho Chehab To: Kangjie Lu Cc: pakki001@umn.edu, "Gustavo A. R. Silva" , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: drx: fix a missing check of return value Message-ID: <20190107172231.49b549db@coco.lan> In-Reply-To: <20181220065747.40379-1-kjlu@umn.edu> References: <20181220065747.40379-1-kjlu@umn.edu> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, 20 Dec 2018 00:57:44 -0600 Kangjie Lu escreveu: > Function drxj_dap_write_reg16(), which writes data to buffer, may fail. > We need to check if it fails, and if so, we should goto error. Did you test this on a real hardware? This kind of patch has a potential of breaking things, as, on some drivers, some writes may return error. For example, when called on early stages, a write may fail because the firmware was not loaded yet. So, a change like that should be carefully tested with real hardware. > Otherwise, the buffer will have incorrect data. > > Signed-off-by: Kangjie Lu > --- > drivers/media/dvb-frontends/drx39xyj/drxj.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c > index 551b7d65fa66..d105125bc1c3 100644 > --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c > +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c > @@ -2136,9 +2136,13 @@ int drxj_dap_atomic_read_write_block(struct i2c_device_addr *dev_addr, > > word = ((u16) data[2 * i]); > word += (((u16) data[(2 * i) + 1]) << 8); > - drxj_dap_write_reg16(dev_addr, > + rc = drxj_dap_write_reg16(dev_addr, > (DRXJ_HI_ATOMIC_BUF_START + i), > word, 0); > + if (rc) { > + pr_err("error %d\n", rc); > + goto rw_error; > + } > } > } > Thanks, Mauro