[PATCH] app/test: use memcpy in ipsec test

Morten Brørup mb at smartsharesystems.com
Sat May 30 07:31:40 CEST 2026


> From: Stephen Hemminger [mailto:stephen at networkplumber.org]
> Sent: Saturday, 30 May 2026 00.53
> 
> On Fri, 29 May 2026 22:45:00 +0200
> Morten Brørup <mb at smartsharesystems.com> wrote:
> 
> > > > @@ -604,22 +603,22 @@ setup_test_string_tunneled(struct
> rte_mempool
> > > > *mpool, const char *string,
> > > >  	/* copy outer IP and ESP header */
> > > >  	ipv4_outer.total_length = rte_cpu_to_be_16(t_len);
> > > >  	ipv4_outer.packet_id = rte_cpu_to_be_16(seq);
> > > > -	rte_memcpy(dst, &ipv4_outer, sizeof(ipv4_outer));
> > > > +	memcpy(dst, &ipv4_outer, sizeof(ipv4_outer));
> >
> > How about:
> > *dst = ipv4_outer;
> >
> > Don't know if it applies here.
> 
> Good idea but dst is char *.
> I suppose could use a cast but at that point the good
> properties of assignment disappear.
> 
> Didn't want to go changing other code.

Agree. Better stick with memcpy() than type cast.



More information about the dev mailing list