From patchwork Mon Jul 23 22:10:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10541201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E20F8112B for ; Mon, 23 Jul 2018 22:10:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D177D2852C for ; Mon, 23 Jul 2018 22:10:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4A2728536; Mon, 23 Jul 2018 22:10:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 316602852C for ; Mon, 23 Jul 2018 22:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388105AbeGWXN5 (ORCPT ); Mon, 23 Jul 2018 19:13:57 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:46526 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388052AbeGWXN4 (ORCPT ); Mon, 23 Jul 2018 19:13:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1532383841; x=1563919841; h=from:to:cc:subject:date:message-id; bh=lwlLUckVaDNXP2ucyT2Z5A5jEgNsyUL4ts6ea46kpFY=; b=OG/lhomasEgyhszjK5kE1rRQSp6mhPU7LYVxzzmKKsbnkMp0yBbrCIsK Mw4MChQ2vbubzLBY6dwTBc9ujZ9JKaPYDRM3miy4rPvUUONW66S4h1242 ly9G1ysGC0oZbS1aDhoK+3xQ/+yPlQYOpyKg27tUWmHb+F5Xju+1dyQOa Ht62Q52FC1YvAjSJChBz682aK/4nrimPCjCZ4xyadk8bYZPeIdXleoswP Vig5JCJJ/pLJ/jMd8MuyBJj3olUnPfpqIlGmk7vqrUGmdFOvyIa3LHR1s zWxSTuzZRb0r4Yov1F0cYfig6nCd+w0lCSXhu7aEktt0ScojUB7DMmIF3 A==; X-IronPort-AV: E=Sophos;i="5.51,394,1526313600"; d="scan'208";a="85558654" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 24 Jul 2018 06:10:40 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 23 Jul 2018 14:58:49 -0700 Received: from thinkpad-bart.sdcorp.global.sandisk.com ([10.111.67.248]) by uls-op-cesaip02.wdc.com with ESMTP; 23 Jul 2018 15:10:40 -0700 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche , Christian Benvenuti Subject: [PATCH] RDMA/usnic: Suppress a compiler warning Date: Mon, 23 Jul 2018 15:10:39 -0700 Message-Id: <20180723221039.11887-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.18.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Christian Benvenuti --- drivers/infiniband/hw/usnic/usnic_fwd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_fwd.c b/drivers/infiniband/hw/usnic/usnic_fwd.c index 995a26b65156..bd17220e341b 100644 --- a/drivers/infiniband/hw/usnic/usnic_fwd.c +++ b/drivers/infiniband/hw/usnic/usnic_fwd.c @@ -92,8 +92,7 @@ struct usnic_fwd_dev *usnic_fwd_dev_alloc(struct pci_dev *pdev) ufdev->pdev = pdev; ufdev->netdev = pci_get_drvdata(pdev); spin_lock_init(&ufdev->lock); - strncpy(ufdev->name, netdev_name(ufdev->netdev), - sizeof(ufdev->name) - 1); + strncpy(ufdev->name, ufdev->netdev->name, sizeof(ufdev->name) - 1); return ufdev; }