• Andre Przywara's avatar
    virtio: use strlcpy · 05755b29
    Andre Przywara authored
    
    
    GCC 8.x complains about improper usage of strncpy in virtio/net.c and
    virtio/scsi.c:
    In function 'virtio_scsi_init_one',
        inlined from 'virtio_scsi_init' at virtio/scsi.c:285:7:
    virtio/scsi.c:247:2: error: 'strncpy' specified bound 224 equals destination size [-Werror=stringop-truncation]
      strncpy((char *)&sdev->target.vhost_wwpn, disk->wwpn, sizeof(sdev->target.vhost_wwpn));
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fix this and the other occurences in virtio/ by using strlcpy instead
    of strncpy.
    Signed-off-by: Andre Przywara's avatarAndre Przywara <andre.przywara@arm.com>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    05755b29
net.c 25.4 KB