On Mon, Apr 29, 2019 at 9:19 AM David Laight <david.lai...@aculab.com> wrote: > > > Can then also change memset to zero only two bytes in the Ethernet case. > > > > + if (msg->msg_namelen < sizeof(struct sockaddr_ll)) { > > + msg->msg_namelen = sizeof(struct > > sockaddr_ll); > > + memset(msg->msg_name + copy_len, 0, > > + msg->namelen - copy_len); > > copy_len not defined ....
Was a quick sketch of an iteration on the above, sorry if unclear. Intended to be defined before the branch. > > > + } > > Except that has to be a real memset() not an inlined direct > write of an 8byte register (or 2 writes on a 32bit systems). I wasn't sure whether a 2 byte store would be optimized in a similar manner. That might even be architecture dependent, I imagine? Will leave as is. Thanks for the quick response! > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 > 1PT, UK > Registration No: 1397386 (Wales)