LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Wenwen Wang <wang6495@umn.edu>
Cc: Kangjie Lu <kjlu@umn.edu>,
"open list:I2C SUBSYSTEM" <linux-i2c@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] i2c: core-smbus: fix a potential missing-check bug
Date: Thu, 17 May 2018 15:38:07 +0200 [thread overview]
Message-ID: <20180517133807.dmlf7rlpavmls6cg@ninjato> (raw)
In-Reply-To: <20180510111658.sxf3mvye5q6ihxa7@ninjato>
[-- Attachment #1: Type: text/plain, Size: 1300 bytes --]
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 failure.
> > In most cases, i2c_transfer() can transfer 'num' messages with no error.
> > And so 'status' == 'num'. However, due to unexpected errors, it is probable
> > that only partial messages are transferred by i2c_transfer(). As a result,
> > 'status' != 'num'. This special case is not checked after the invocation of
> > i2c_transfer() and can potentially lead to unexpected issues in the
> > following execution since it is expected that 'status' == 'num'.
> >
> > 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'.
> >
> > Signed-off-by: Wenwen Wang <wang6495@umn.edu>
>
> Applied to for-current, thanks!
Reconsidered and applied to for-next, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2018-05-17 13:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-05 13:02 Wenwen Wang
2018-05-10 11:16 ` Wolfram Sang
2018-05-10 13:36 ` Peter Rosin
2018-05-15 8:58 ` Wolfram Sang
2018-05-15 10:36 ` Peter Rosin
2018-05-17 13:06 ` Wolfram Sang
2018-05-17 13:38 ` Wolfram Sang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180517133807.dmlf7rlpavmls6cg@ninjato \
--to=wsa@the-dreams.de \
--cc=kjlu@umn.edu \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wang6495@umn.edu \
--subject='Re: [PATCH v2 2/2] i2c: core-smbus: fix a potential missing-check bug' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).