Re: net: alignment problem in icmp code

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Pierre Ossman
Date: Sunday, October 21, 2007 - 9:54 pm

On Sun, 21 Oct 2007 16:02:15 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:


I'm not debating that. What I'm saying is that calling memcpy() casts your =
pointers to void* with the included semantical changes. It can't just ignor=
e that because it decides to inline the function. It would be the same thin=
g as when gcc decided to ignore the volatile qualifier on a pointer just be=
cause it could optimize away to the real object and discover it wasn't mark=
ed with volatile. Something that was considered a bug and was fixed.


gcc has had bugs in the past.


I assume those ops cause a bus error on unaligned addresses?


It wouldn't be magic:

memcpy(&icmp_param.data.icmph, skb_transport_header(skb), sizeof(struct icm=
phdr));

I believe platforms without alignment requirements could optimize this bett=
er than the series of assignments. Not that I think this will be a potentia=
l bottle neck, but still.


Indeed.

Rgds
Pierre
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
net: alignment problem in icmp code, Pierre Ossman, (Sat Oct 20, 2:35 pm)
Re: net: alignment problem in icmp code, David Miller, (Sat Oct 20, 10:12 pm)
Re: net: alignment problem in icmp code, Pierre Ossman, (Sun Oct 21, 2:34 am)
Re: net: alignment problem in icmp code, David Miller, (Sun Oct 21, 12:48 pm)
Re: net: alignment problem in icmp code, Pierre Ossman, (Sun Oct 21, 2:21 pm)
Re: net: alignment problem in icmp code, David Miller, (Sun Oct 21, 4:02 pm)
Re: net: alignment problem in icmp code, Pierre Ossman, (Sun Oct 21, 9:54 pm)
Re: net: alignment problem in icmp code, David Miller, (Sun Oct 21, 10:15 pm)
Re: net: alignment problem in icmp code, Pierre Ossman, (Mon Oct 22, 12:23 am)
Re: net: alignment problem in icmp code, David Miller, (Mon Oct 22, 1:31 am)
Re: net: alignment problem in icmp code, Pierre Ossman, (Mon Oct 22, 1:42 am)
Re: net: alignment problem in icmp code, David Miller, (Mon Oct 22, 2:05 am)
Re: net: alignment problem in icmp code, Pierre Ossman, (Mon Oct 22, 2:26 am)
Re: net: alignment problem in icmp code, Eric Dumazet, (Mon Oct 22, 2:52 am)