2013-08-05 20:05:07

by Malcolm Priestley

[permalink] [raw]
Subject: [PATCH 1/3] staging: vt6656: rxtx.h always pack BEACON_BUFFER/TX_BUFFER

All structure members of BEACON_BUFFER/TX_BUFFER should be packed.

Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6656/rxtx.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index dd7e85d..d854b38 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -609,7 +609,7 @@ typedef struct tagSTX_BUFFER
// Actual message
TX_BUFFER_CONTAINER BufferHeader;

-} TX_BUFFER, *PTX_BUFFER;
+} __packed TX_BUFFER, *PTX_BUFFER;

//
// Remote NDIS message format
@@ -626,7 +626,7 @@ typedef struct tagSBEACON_BUFFER
// Actual message
TX_BUFFER_CONTAINER BufferHeader;

-} BEACON_BUFFER, *PBEACON_BUFFER;
+} __packed BEACON_BUFFER, *PBEACON_BUFFER;

void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb);
int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb);
--
1.8.1.2





2013-08-13 00:26:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: vt6656: rxtx.h always pack BEACON_BUFFER/TX_BUFFER

On Tue, Aug 13, 2013 at 12:35:16AM +0100, Malcolm Priestley wrote:
> On Mon, 2013-08-12 at 16:09 -0700, Greg KH wrote:
> > On Tue, Aug 13, 2013 at 12:07:15AM +0100, Malcolm Priestley wrote:
> > > On Mon, 2013-08-12 at 14:59 -0700, Greg KH wrote:
> > > > On Mon, Aug 05, 2013 at 09:04:54PM +0100, Malcolm Priestley wrote:
> > > > > All structure members of BEACON_BUFFER/TX_BUFFER should be packed.
> > > >
> > > > Why?
> > >
> > > Only the first 4 members of these structures are live.
> > >
> > > The forth member is referenced at run-time by packed structures.
> > > typedef struct tagSTxBufHead
> > > typedef struct tagSTxShortBufHead
> > > in desc.h
> > >
> > > If these structures are not packed the alignment of these members
> > > will be wrong.
> >
> > Then say all of this in the patch please :)
> >
> > > >
> > > > What happens if they are not?
> > > The driver does not work.
> >
> > How is it working today without this change?
> Well for *me* it works.
>
> It appears the structure is packed anyway.
>
> But is this guaranteed?
>
> Anyway, do you want me to resend the patch.
>

Yes, please do, with this added information, and all other patches from
you that I did not apply, due to me not accepting this one.

thanks,

greg k-h

2013-08-12 22:00:00

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: vt6656: rxtx.h always pack BEACON_BUFFER/TX_BUFFER

On Mon, Aug 05, 2013 at 09:04:54PM +0100, Malcolm Priestley wrote:
> All structure members of BEACON_BUFFER/TX_BUFFER should be packed.

Why?

What happens if they are not?

greg k-h

2013-08-12 23:09:38

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: vt6656: rxtx.h always pack BEACON_BUFFER/TX_BUFFER

On Tue, Aug 13, 2013 at 12:07:15AM +0100, Malcolm Priestley wrote:
> On Mon, 2013-08-12 at 14:59 -0700, Greg KH wrote:
> > On Mon, Aug 05, 2013 at 09:04:54PM +0100, Malcolm Priestley wrote:
> > > All structure members of BEACON_BUFFER/TX_BUFFER should be packed.
> >
> > Why?
>
> Only the first 4 members of these structures are live.
>
> The forth member is referenced at run-time by packed structures.
> typedef struct tagSTxBufHead
> typedef struct tagSTxShortBufHead
> in desc.h
>
> If these structures are not packed the alignment of these members
> will be wrong.

Then say all of this in the patch please :)

> >
> > What happens if they are not?
> The driver does not work.

How is it working today without this change?

thanks,

greg k-h

2013-08-12 23:07:24

by Malcolm Priestley

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: vt6656: rxtx.h always pack BEACON_BUFFER/TX_BUFFER

On Mon, 2013-08-12 at 14:59 -0700, Greg KH wrote:
> On Mon, Aug 05, 2013 at 09:04:54PM +0100, Malcolm Priestley wrote:
> > All structure members of BEACON_BUFFER/TX_BUFFER should be packed.
>
> Why?

Only the first 4 members of these structures are live.

The forth member is referenced at run-time by packed structures.
typedef struct tagSTxBufHead
typedef struct tagSTxShortBufHead
in desc.h

If these structures are not packed the alignment of these members
will be wrong.

>
> What happens if they are not?
The driver does not work.

Regards


Malcolm




2013-08-12 23:35:25

by Malcolm Priestley

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: vt6656: rxtx.h always pack BEACON_BUFFER/TX_BUFFER

On Mon, 2013-08-12 at 16:09 -0700, Greg KH wrote:
> On Tue, Aug 13, 2013 at 12:07:15AM +0100, Malcolm Priestley wrote:
> > On Mon, 2013-08-12 at 14:59 -0700, Greg KH wrote:
> > > On Mon, Aug 05, 2013 at 09:04:54PM +0100, Malcolm Priestley wrote:
> > > > All structure members of BEACON_BUFFER/TX_BUFFER should be packed.
> > >
> > > Why?
> >
> > Only the first 4 members of these structures are live.
> >
> > The forth member is referenced at run-time by packed structures.
> > typedef struct tagSTxBufHead
> > typedef struct tagSTxShortBufHead
> > in desc.h
> >
> > If these structures are not packed the alignment of these members
> > will be wrong.
>
> Then say all of this in the patch please :)
>
> > >
> > > What happens if they are not?
> > The driver does not work.
>
> How is it working today without this change?
Well for *me* it works.

It appears the structure is packed anyway.

But is this guaranteed?

Anyway, do you want me to resend the patch.