From: Al Viro <viro@ftp.linux.org.uk>
To: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: "David S. Miller" <davem@davemloft.net>,
alan@lxorguk.ukuu.org.uk, akpm@osdl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] I2O: SPARC fixes
Date: Sun, 20 Nov 2005 23:21:58 +0000 [thread overview]
Message-ID: <20051120232158.GE27946@ftp.linux.org.uk> (raw)
In-Reply-To: <20051120230714.GD27946@ftp.linux.org.uk>
On Sun, Nov 20, 2005 at 11:07:14PM +0000, Al Viro wrote:
> And here's another fun one:
> evt->size = size;
> evt->tcntxt = le32_to_cpu(msg->u.s.tcntxt);
> evt->event_indicator = le32_to_cpu(msg->body[0]);
> memcpy(&evt->tcntxt, &msg->u.s.tcntxt, size * 4);
> in i2o_driver_dispatch().
Gaaack... Old code used to be
evt = kmalloc(size * 4 + sizeof(*evt), GFP_ATOMIC);
if (!evt)
return -ENOMEM;
memset(evt, 0, size * 4 + sizeof(*evt));
evt->size = size;
memcpy_fromio(&evt->tcntxt, &msg->u.s.tcntxt,
(size + 2) * 4);
Then it became
evt->size = size;
evt->tcntxt = readl(&msg->u.s.tcntxt);
evt->event_indicator = readl(&msg->body[0]);
memcpy_fromio(&evt->tcntxt, &msg->u.s.tcntxt, size * 4);
See the problem with it? The last copy should be from &msg->body[1] to
evt->data. As it is, we do not copy the last 8 bytes (which might or
might not be a problem) *AND* we overwrite tcntxt and event_indicator
with bus-endian values right after having host-endian ones carefully
assigned to them.
Breakage happened in
diff-tree 61fbfa8129c1771061a0e9f47747854293081c5b (from 34d6e07570ef74b96513145
Author: Markus Lidel <Markus.Lidel@shadowconnect.com>
Date: Thu Jun 23 22:02:11 2005 -0700
[PATCH] I2O: bugfixes and compability enhancements
next prev parent reply other threads:[~2005-11-20 23:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-15 9:31 [PATCH 2/5] I2O: SPARC fixes Markus Lidel
2005-11-15 21:28 ` David S. Miller
2005-11-16 12:25 ` Markus Lidel
2005-11-16 19:18 ` David S. Miller
2005-11-17 8:12 ` Markus Lidel
2005-11-19 1:07 ` Markus Lidel
2005-11-19 1:22 ` David S. Miller
2005-11-19 3:30 ` Alan Cox
2005-11-19 4:37 ` David S. Miller
2005-11-19 13:18 ` Alan Cox
2005-11-20 21:38 ` Markus Lidel
2005-11-20 21:42 ` Markus Lidel
2005-11-20 22:52 ` Al Viro
2005-11-20 23:07 ` Al Viro
2005-11-20 23:21 ` Al Viro [this message]
2005-11-21 0:48 ` Markus Lidel
2005-11-21 1:20 ` Al Viro
2005-11-21 3:38 ` Al Viro
2005-11-21 8:46 ` Markus Lidel
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=20051120232158.GE27946@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=Markus.Lidel@shadowconnect.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.