Commit 0abb60c1 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: unisys: visorchannel_write(): Handle partial channel_header writes

Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36203e71
......@@ -213,13 +213,16 @@ int
visorchannel_write(struct visorchannel *channel, ulong offset,
void *local, ulong nbytes)
{
size_t size = sizeof(struct channel_header);
size_t chdr_size = sizeof(struct channel_header);
size_t copy_size;
if (offset + nbytes > channel->memregion.nbytes)
return -EIO;
if (!offset && nbytes >= size)
memcpy(&channel->chan_hdr, local, size);
if (offset < chdr_size) {
copy_size = min(chdr_size, nbytes) - offset;
memcpy(&channel->chan_hdr + offset, local, copy_size);
}
memcpy_toio(channel->memregion.mapped + offset, local, nbytes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment