From: Markus Lidel <Markus.Lidel@shadowconnect.com>
To: Al Viro <viro@ftp.linux.org.uk>
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: Mon, 21 Nov 2005 01:48:10 +0100 [thread overview]
Message-ID: <4381194A.3080609@shadowconnect.com> (raw)
In-Reply-To: <20051120232158.GE27946@ftp.linux.org.uk>
Hello,
Al Viro wrote:
> 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
At the moment it's not a problem, because the event system is not used...
> with bus-endian values right after having host-endian ones carefully
> assigned to them.
Yep, you're right... the memcpy_fromio is wrong... It should be:
memcpy_fromio(&evt->body[1], &msg->body[1], size * 4);
as you already mentioned...
Thanks for your help.
Best regards,
Markus Lidel
------------------------------------------
Markus Lidel (Senior IT Consultant)
Shadow Connect GmbH
Carl-Reisch-Weg 12
D-86381 Krumbach
Germany
Phone: +49 82 82/99 51-0
Fax: +49 82 82/99 51-11
E-Mail: Markus.Lidel@shadowconnect.com
URL: http://www.shadowconnect.com
next prev parent reply other threads:[~2005-11-21 0:48 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
2005-11-21 0:48 ` Markus Lidel [this message]
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=4381194A.3080609@shadowconnect.com \
--to=markus.lidel@shadowconnect.com \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/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.