Re: [PATCH] RDMA/usnic: Suppress a compiler warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 18, 2018 at 09:03:29AM -0700, Bart Van Assche wrote:
> This patch avoids that the following compiler warning is reported when
> building with gcc 8 and W=1:
> 
> drivers/infiniband/hw/usnic/usnic_fwd.c:95:2: warning: 'strncpy' output may be truncated copying 16 bytes from a string of length 20 [-Wstringop-truncation]
>   strncpy(ufdev->name, netdev_name(ufdev->netdev),
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     sizeof(ufdev->name) - 1);
>     ~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx>
> Cc: Christian Benvenuti <benve@xxxxxxxxx>
> Cc: Dave Goodell <dgoodell@xxxxxxxxx>
> ---
>  drivers/infiniband/hw/usnic/usnic_fwd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

I think this is a bug in netdev_name, it shouldn't return a constant
string longer than IFNAMSIZ.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux