nl: avoid NULL pointer dereference
nl: avoid NULL pointer dereference

It's a valid case to call nla_put() with NULL data and 0 len. It's done e.g. in
the nla_put_attr().

There has to be a check for data in nla_put() as passing NULL to the memcpy()
is not allowed. Even if length is 0, both pointers have to be valid.

For a reference see C99 standard (7.21.1/2), it says: "pointer arguments on
such a call shall still have valid values".

Reported-by: Daniel Gimpelevich <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@gimpelevich.san-francisco.ca.us>
Signed-off-by: Rafał Miłecki <68396d1faf4100deae824f26e1be60d81c1ce164@milecki.pl>
[48455ab3070520a2d174545c7239d6d0fabd9a83@ubuntu.com: adapted commit message]
Signed-off-by: Christian Brauner <48455ab3070520a2d174545c7239d6d0fabd9a83@ubuntu.com>

caglar10ur/lxc,ss1h2a3tw/lxc,ss1h2a3tw/lxc,caglar10ur/lxc,hallyn/lxc,hallyn/lxc,ss1h2a3tw/lxc,hallyn/lxc,caglar10ur/lxc