Received: by 10.192.165.148 with SMTP id m20csp1008211imm; Thu, 10 May 2018 04:17:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrVO6PVeNm115zOtOGq6YEKXDvVyp6vGCW9YTZR4lwFxB5MPSeJkHhoEnUUymyGMm6CiIz+ X-Received: by 2002:a63:ab45:: with SMTP id k5-v6mr774768pgp.199.1525951070567; Thu, 10 May 2018 04:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525951070; cv=none; d=google.com; s=arc-20160816; b=KnXN2IqwPS9syZAXXzeWLvHJqEaogEbBYmWvao9ulPhaLOj+V839m2BfRRntZEbU/e j/kBrVlt894lsdsqFckmd7R+g3zmdskNkspAeBYNRuSyeQb8fVpphTsYH+nBBcwNJ9ws hEbc5awxf6CfZup+5ozOcAydBdmJ+E2VEmuU1UQ8yY9umBx9Xs9GiNvcqpzpgjc1y05Z K5YdS/SNwI1uR01BGk3xBmcIWx5o2WiLj6NeUj8eOXAIQtZ1mV+3zakbp4DbufZf6dbd kc2rL0vfy+V8By28mZomga951x4fecRNvYUvzsZVOFuhR1a/Jhh0kfDfcbQ6heEOrMn+ 2v7w== 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=Swmo1jeyxs0KoPhnnsZqNPb6MyvsurbdAJ1z7x3w3HY=; b=RjGzivwqvV8V7hukBcu4h9dn+UlCLx4yMqT99wVHP8i27aMlhQembSsJKgiJETcUdR PJLxUcvsJxwuhluaJh6FRJFwAsQxaRDxJ9HAIboBom7EEp80ZeBgGQJ568goFLGttNo5 yGl0NjYDSrWtC8vJu9I1zDTbo6aYjWHWFhmrUike+0FNVhwZwdNjvO+MaojEDrASAGPX 5vNzlzQj7sjMeLMLpfWSJFwo3qgAkCY5mnxODMwkRRm9DOGa266V/7dKwVAyElG0Nzvq wgX108kbLJGGd0sxcn36VIsOg4QBMiMkvus5nItynvs3HBt9TKZSFKM1sIWYL4rtFkA7 wfeQ== 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 k17-v6si565109pfj.310.2018.05.10.04.17.36; Thu, 10 May 2018 04:17:50 -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 S935318AbeEJLRC (ORCPT + 99 others); Thu, 10 May 2018 07:17:02 -0400 Received: from sauhun.de ([88.99.104.3]:45538 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934002AbeEJLRB (ORCPT ); Thu, 10 May 2018 07:17:01 -0400 Received: from localhost (p54B33405.dip0.t-ipconnect.de [84.179.52.5]) by pokefinder.org (Postfix) with ESMTPSA id 5F1E234BC78; Thu, 10 May 2018 13:16:59 +0200 (CEST) Date: Thu, 10 May 2018 13:16:59 +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: <20180510111658.sxf3mvye5q6ihxa7@ninjato> References: <1525525341-10046-1-git-send-email-wang6495@umn.edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="a4rj7r37xo5co7xp" Content-Disposition: inline In-Reply-To: <1525525341-10046-1-git-send-email-wang6495@umn.edu> 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 --a4rj7r37xo5co7xp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 failure. > 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 pr= obable > that only partial messages are transferred by i2c_transfer(). As a result, > 'status' !=3D 'num'. This special case is not checked after the invocatio= n 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 error > code -EIO if the number of actual transferred messages 'status' is not > equal to 'num'. >=20 > Signed-off-by: Wenwen Wang Applied to for-current, thanks! --a4rj7r37xo5co7xp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAlr0KiYACgkQFA3kzBSg KbZUBA/+PP2xTiov4iCAOKU/d10p7NoCc3vspqQEPIs7aa8CA6fBP7ht34b9dhr8 A6vqF4YbZEtcTAXj6giQ+X2BwfrJRdKc7vJngAV60LiJvi05/0a6Ec3jq3Mtk2wr RsFDcBgTT+6xAyJe6ySoG56tQ3xQxIVMyQNo8suM5va/+it9JWNgZhfU1p8lA0le XP+og3lfMaD7JGPQLoocdgUfWCYFJd/9+UMIvvenwTzyEAtuH8PJxSMyuVwHQj88 TVboCCzSHb7IQrtNcEY7QmR8LFMP+RP8OEOd21urqmswJwtfrKnEA+bX/M9srTsM JgXkVauTiNJ77MZUBvQoDH0b8LkHVvDG5sP1Ho0NsSH9Z7P7Z5DRlweNoUgVCsDZ xQ+R3nDuZR07lntqJHSJGT9+VPs6ESC7pF2iL3s31lVgPL94QxNeHNXbB9P38+Jh 4yGCB8M/u8soY5N0TKsv1ECCIUg4oaxAaL2D6hARhlLhnCP7DrT/KmCyWuMH8AzL bkw3vIVpy6U0kT78MwFeK9fldzzkv7x6C14DP0wlYsXkC42Eduv3q5tdHONAifDu HHoN/LyYPfnwjHD1bq9IpnTCreUxm9IFb7lEV2T2C8Jkb24cdwUlHkoE6UMp2XaP 4Zn2uD6lsVLI0nQOnWjmU59R9mo5oiiaFbhzkdwFzao2Dj+nXAE= =EPpy -----END PGP SIGNATURE----- --a4rj7r37xo5co7xp--