Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3295491imm; Thu, 17 May 2018 06:39:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpF5Dd3laB+yQg6D9F3/vYK5q79JBMHEpPHRD1kf26LZfI/ak+3MQydhKmZUkByl2EmEIrC X-Received: by 2002:a62:e107:: with SMTP id q7-v6mr5233260pfh.226.1526564347756; Thu, 17 May 2018 06:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526564347; cv=none; d=google.com; s=arc-20160816; b=AUHsFcB8iQNw7dCTvSgPaHGhANX+BCc9wA9pvg0Cp3P4ROauMM153LosGYFHd5dsvw h1qYIY08encM3rdJWoW92kBUppRfb7DC6avNWK1UCuElg+c2z5L1k8h0X1g8rAA81CEa MvLtdz2F8YFbhnh3xWg+VtpyXE5smEFe0puN8UKVgtJizrwSETprPZH+xlntpXHBnb8m WgOAeuc9R2aHQw3S8kMk6QQbhEXQhI6Pma85m0BSqLKB0WR67m3RgfuZ4zqfEgN10WMY D64Ac12BVtKWqrsHvx4QkqOM9RswILP0wmjua7EHIf16K3JvKg/rYmTluSVQkhqlCYJ6 opmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=6Y403Nl9M18RaW4SIqS9r9wo9QP92bFEXLFjY9hoL+4=; b=m+Sq5+wW9axbfuqsi8k5P/DmvlS5cLs6wYbfV+CqOmI5HFjukQVcDsDc3R6lGXowOc xWDcmonRciJ4Cw1qOFx+1iBOalDpPXGzDfoG/7C5sdjTtGmyq6GWbNbleaIWYOYR4Wq9 Z6w/Npb9Dd5fg5jxYJu4AhDkdq981dsxvxWDiWMKYjOyNCG6INZTyjAzrgPLTTFiRvO8 NsaSi2v58NM3h98uSewPNyZF9hhkTOt2lGEQtTx/PflCh2PD9/ljY0VIAX+vx/1kkgWh gX7FsdFL81B4zjT+LERF6FhWGwb+omjie8TLNbALhr8Qm2XEusX13tvvV01s0ThucF7z pgog== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23-v6si4922165ply.237.2018.05.17.06.38.52; Thu, 17 May 2018 06:39:07 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752141AbeEQNiK (ORCPT + 99 others); Thu, 17 May 2018 09:38:10 -0400 Received: from sauhun.de ([88.99.104.3]:51290 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750938AbeEQNiJ (ORCPT ); Thu, 17 May 2018 09:38:09 -0400 Received: from localhost (p54B3345A.dip0.t-ipconnect.de [84.179.52.90]) by pokefinder.org (Postfix) with ESMTPSA id 75D8F3640A7; Thu, 17 May 2018 15:38:07 +0200 (CEST) Date: Thu, 17 May 2018 15:38:07 +0200 From: Wolfram Sang To: Wenwen Wang Cc: Kangjie Lu , "open list:I2C SUBSYSTEM" , open list Subject: Re: [PATCH v2 2/2] i2c: core-smbus: fix a potential missing-check bug Message-ID: <20180517133807.dmlf7rlpavmls6cg@ninjato> References: <1525525341-10046-1-git-send-email-wang6495@umn.edu> <20180510111658.sxf3mvye5q6ihxa7@ninjato> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vvt4nisdeyjjnky4" Content-Disposition: inline In-Reply-To: <20180510111658.sxf3mvye5q6ihxa7@ninjato> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --vvt4nisdeyjjnky4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 10, 2018 at 01:16:59PM +0200, Wolfram Sang wrote: > On Sat, May 05, 2018 at 08:02:21AM -0500, Wenwen Wang wrote: > > In i2c_smbus_xfer_emulated(), the function i2c_transfer() is invoked to > > transfer i2c messages. The number of actual transferred messages is > > returned and saved to 'status'. If 'status' is negative, that means an > > error occurred during the transfer process. In that case, the value of > > 'status' is an error code to indicate the reason of the transfer failur= e. > > In most cases, i2c_transfer() can transfer 'num' messages with no error. > > And so 'status' =3D=3D 'num'. However, due to unexpected errors, it is = probable > > that only partial messages are transferred by i2c_transfer(). As a resu= lt, > > 'status' !=3D 'num'. This special case is not checked after the invocat= ion of > > i2c_transfer() and can potentially lead to unexpected issues in the > > following execution since it is expected that 'status' =3D=3D 'num'. > >=20 > > This patch checks the return value of i2c_transfer() and returns an err= or > > code -EIO if the number of actual transferred messages 'status' is not > > equal to 'num'. > >=20 > > Signed-off-by: Wenwen Wang >=20 > Applied to for-current, thanks! Reconsidered and applied to for-next, thanks! --vvt4nisdeyjjnky4 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlr9hboACgkQFA3kzBSg KbYi4g/9GkQOcONR0sLn2iA40fe80fR0lb8WO6fQD4LSskofEiVyuRNgOHzNPg8R DnAbinrpUjuq1GWFlNZyivbiTQFs7ku9oMbt0XcJ0ZmxvgHNJmAUObj+WpkW2mJ+ oCeJbRKdG3uVuvBtuULe7gbRKwIgdVVWt2hxnXX6X56i/8qZGpJo9v7J0zD/JsRd zfjBpn0mndG3Mpw/lEOnhnteUduG30h4OtlBTqwTqzaIxfIFBY2ja1P78dbfSotX sju3EC71m4qmqQoKn9vtquk5QLyCFDXYNDSg46DJ3chfWKges/Ip7iFA5j2BiSAC Em4uOW4yBBF/0OXcdg5w3dSsmdCdkhVRJOsCXsMYmh5cQS1zDasUWRD+/kZX/ve7 AphPlCOWW6G6OcY5ACaeCzMXcTnEEi1MIaWlOyWa7xnAq+fSdYWESGivQZzF3FYd F9AZMF+/gg3URbY59NLxXbdXPhZb41OjjRLnt3OOW0FuAWLSUqyeYPIK81rlNfny n+4igX4ikdq7AgpIoq6NgXRfMYP6RFMgg5idg/bGcb0sp8z/ya1eYIJbblLGLnr6 xzkUtbBYxysLgVUxTcTWJPDOntcTY8G8i+KlS/RjWuJ5yHZBDmYumzP0J5qmjCS/ D70rCqy7rok88MuORmVhaS3UcMRENGK5A5pkwHlATsRNhzuSZzk= =fN6z -----END PGP SIGNATURE----- --vvt4nisdeyjjnky4--