All of lore.kernel.org
 help / color / mirror / Atom feed
From: JiSheng Zhang <jszhang3@mail.ustc.edu.cn>
To: stefanr@s5r6.in-berlin.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] firewire:queue the right number of data
Date: Sat, 19 Jul 2008 15:35:41 +0800	[thread overview]
Message-ID: <416453059.30160@ustc.edu.cn> (raw)
Message-ID: <20080719153541.70eb7f17.jszhang3@mail.ustc.edu.cn> (raw)

Hi,

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.

Sorry for open a new ticket.

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

--- old/drivers/firewire/fw-cdev.c
+++ new/drivers/firewire/fw-cdev.c
@@ -382,9 +382,9 @@
 
 	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)

             reply	other threads:[~2008-07-19  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-19  7:35 JiSheng Zhang [this message]
2008-07-19  7:35 ` [PATCH] firewire:queue the right number of data JiSheng Zhang
2008-07-20 14:00   ` Stefan Richter
     [not found]   ` <416562490.30709@ustc.edu.cn>
2008-07-21  6:48     ` JiSheng Zhang
2008-07-21  6:48       ` JiSheng Zhang

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=416453059.30160@ustc.edu.cn \
    --to=jszhang3@mail.ustc.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /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.