Skip to content

Commit

Permalink
firewire: queue the right number of data
Browse files Browse the repository at this point in the history
There will be 4 padding bytes in struct fw_cdev_event_response on some platforms
The member:__u32 data will point to these padding bytes. While queue the
response and data in complete_transaction in fw-cdev.c, it will queue like this:
|response(excluding padding bytes)|4 padding bytes|4 padding bytes|data.
It queue 4 extra bytes. That is to say it use "&response + sizeof(response)"
while other place of kernel and userspace library use "&response + offsetof
(typeof(response), data)". So it will lost the last 4 bytes of data. This patch
can fix it while not changing the struct definition.

Signed-off-by: JiSheng Zhang <jszhang3@mail.ustc.edu.cn>

This fixes responses to outbound block read requests on 64bit architectures.
Tested on i686, x86-64, and x86-64 with i686 userland, using firecontrol and
gscanbus.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
  • Loading branch information
JiSheng Zhang authored and Stefan Richter committed Jul 20, 2008
1 parent 1e8afea commit f9543d0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/firewire/fw-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ complete_transaction(struct fw_card *card, int rcode,

response->response.type = FW_CDEV_EVENT_RESPONSE;
response->response.rcode = rcode;
queue_event(client, &response->event,
&response->response, sizeof(response->response),
response->response.data, response->response.length);
queue_event(client, &response->event, &response->response,
sizeof(response->response) + response->response.length,
NULL, 0);
}

static int ioctl_send_request(struct client *client, void *buffer)
Expand Down

0 comments on commit f9543d0

Please sign in to comment.