Subject: Re: [PATCH net-next] net-timestamp: expand documentation

From: Daniel Borkmann <[email-masked]>
Date: Thu, 04 Sep 2014 14:56:04 +0200

Hi Willem,

On 09/01/2014 03:27 AM, Willem de Bruijn wrote:
> Expand Documentation/networking/timestamping.txt with new
> interfaces and bytestream timestamping. Also minor
> cleanup of the other text.
>
> Import txtimestamp.c test of the new features.
>
> Signed-off-by: Willem de Bruijn <[email-masked]>
...
> +static int recv_errmsg(int fd)
> +{
> +	static char ctrl[1024 /* overprovision*/];
> +	static struct msghdr msg;
> +	struct iovec entry;
> +	static char *data;
> +	int ret = 0;
> +
> +	data = malloc(cfg_payload_len);
> +	if (!data)
> +		error(1, 0, "malloc");
> +
> +	memset(&msg, 0, sizeof(msg));
> +	memset(&entry, 0, sizeof(entry));
> +	memset(ctrl, 0, sizeof(ctrl));
> +	memset(data, 0, sizeof(data));

I think this memset is wrong and should rather be
something like :

	memset(data, 0, cfg_payload_len);

> +	entry.iov_base = data;
> +	entry.iov_len = cfg_payload_len;
> +	msg.msg_iov = &entry;
> +	msg.msg_iovlen = 1;
> +	msg.msg_name = NULL;
> +	msg.msg_namelen = 0;
> +	msg.msg_control = ctrl;
> +	msg.msg_controllen = sizeof(ctrl);