From: Eric Dumazet <eric.duma...@gmail.com>
Date: Sat, 18 Jun 2016 21:03:29 -0700

> On Sat, 2016-06-18 at 20:54 -0700, David Miller wrote:
>> From: Eric Dumazet <eduma...@google.com>
>> Date: Sat, 18 Jun 2016 16:26:40 -0700
>> 
>> > @@ -588,12 +594,26 @@ int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, 
>> > int nhs, int type)
>> >            skb2->dev = rt->dst.dev;
>> >  
>> >    ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr, &temp_saddr);
>> > +
>> > +  if (data_len) {
>> > +          /* RFC 4884 (partial) support :
>> > +           * insert 0 padding at the end, before the extensions
>> > +           */
>> > +          __skb_push(skb2, nhs);
>> > +          skb_reset_network_header(skb2);
>> > +          memcpy(skb2->data, skb2->data + nhs, data_len - nhs);
>> 
>> Since this is overlapping, it really need to use memmove() instead of
>> memcpy().
> 
> 
> Interesting, I always thought memcpy(dest, src, xxx) was ok if src >
> dest

The golden rule is: "the memory areas must not overlap"

If it can be optimized into calling a memcpy, the memmove
implementation will do so.

Reply via email to