mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: JiSheng Zhang <jszhang3@mail.ustc.edu.cn>
Cc: linux-kernel@vger.kernel.org,
	linux1394-devel@lists.sourceforge.net, krh@redhat.com
Subject: Re: PATCH] firewire: add padding to some struct
Date: Fri, 18 Jul 2008 12:49:11 +0200	[thread overview]
Message-ID: <48807527.9060806@s5r6.in-berlin.de> (raw)
In-Reply-To: <416371533.19965@ustc.edu.cn>

JiSheng Zhang wrote:
> struct fw_cdev_event_response and struct fw_cdev_event_iso_interrupt need padding.
> Otherwise, offset of the zero length array is not equal to the struct size. It may
> cause some strange problems under some platforms such as sparc32. This
> patch(against 2.6.26) should fix it.

The best solution to this problem would be to use

	offsetof(struct fw_cdev_event_XYZ, data)

instead of sizeof(struct fw_cdev_event_XYZ) in all the places where the
offset is required.

Your proposed solution to add padding...

> --- old/include/linux/firewire-cdev.h	2008-07-18 16:34:01.181794046 +0800
> +++ new/include/linux/firewire-cdev.h	2008-07-18 16:35:46.649294275 +0800
> @@ -92,6 +92,7 @@
>  	__u32 type;
>  	__u32 rcode;
>  	__u32 length;
> +	__u32 pad;
>  	__u32 data[0];
>  };
>  
> @@ -143,6 +144,7 @@
>  	__u32 type;
>  	__u32 cycle;
>  	__u32 header_length;
> +	__u32 pad;
>  	__u32 header[0];
>  };
>  

...can alas not be applied because it would break ABI compatibility.

Thanks for looking into it,
-- 
Stefan Richter
-=====-==--- -=== =--=-
http://arcgraph.de/sr/

  reply	other threads:[~2008-07-18 10:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  8:58 JiSheng Zhang
2008-07-18 10:49 ` Stefan Richter [this message]
2008-07-18 11:16 JiSheng Zhang
2008-07-18 11:38 ` Stefan Richter
2008-07-18 11:58   ` Stefan Richter
2008-07-18 12:07 JiSheng Zhang
2008-07-18 12:31 JiSheng Zhang
2008-07-18 15:27 ` Mikael Pettersson
     [not found] ` <416443505.10974@ustc.edu.cn>
     [not found]   ` <20080719154115.21334197.jszhang3@mail.ustc.edu.cn>
2008-07-19  7:41     ` JiSheng Zhang
2008-07-19 10:32       ` Stefan Richter
     [not found]       ` <416463624.22263@ustc.edu.cn>
     [not found]         ` <20080720142027.772e5d03@debian>
2008-07-20  6:20           ` JiSheng Zhang
2008-07-19 10:09     ` Mikael Pettersson
     [not found]     ` <416625421.30590@ustc.edu.cn>
     [not found]       ` <20080721153757.460c6a48@debian>
2008-07-21  7:37         ` 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=48807527.9060806@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=jszhang3@mail.ustc.edu.cn \
    --cc=krh@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®