virtio: fix warning on strncpy

GCC 8.2 gives this warning:

virtio/net.c: In function ‘virtio_net__tap_init’:
virtio/net.c:336:47: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
   strncpy(ifr.ifr_name, ndev->tap_name, sizeof(ndev->tap_name));
                                               ^
virtio/net.c:348:47: error: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
   strncpy(ifr.ifr_name, ndev->tap_name, sizeof(ndev->tap_name));
                                               ^

Fix it by using sizeof of destination instead, even if they're the same
size in this case.

Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Anisse Astier <aastier@freebox.fr>
Signed-off-by: Will Deacon <will.deacon@arm.com>
1 file changed