Received: by 2002:a4a:3008:0:0:0:0:0 with SMTP id q8-v6csp3483137oof; Mon, 10 Sep 2018 15:38:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYt3rD5ylnBBLwhNWcydvsonq++bgJx+4uu2MeQezkMsWTjo//NRdexFkcIWm/ZeU9MxOxU X-Received: by 2002:a63:7511:: with SMTP id q17-v6mr25374454pgc.144.1536619088052; Mon, 10 Sep 2018 15:38:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536619088; cv=none; d=google.com; s=arc-20160816; b=f1mJ795RIqIc0coDQHAtwPSmuXyglJmqkTWfggAlgZI8oMAkMtH3p9GvBNvn0k3iNs J6GvOq3S+v56RW3dEz5FB7X4r5bmI9DWogKIlWOlLa5X6GsJeEi0zMQwW6SuiuZtt3Qd NuuJgxoOl2QnX59QnJU0pGWYIWiy1MdiWYcA0+CWB8SeMiTRTCenByEyZiVWu0CBIF8n J9X0TRsLl6ASk1wrFFpFAVEjhu3ESmT1jgTtnMXyyAi/J1dX2PiDCD/mKpP2xOpiMJBz vvlmDzrq3m03B3HvdR4lan9zrGPATUkpMxQQUBywCgAWJpCc0kaoHG/IRBXMoDFfTRS1 KCPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=hN158MWIS1t7Do7D9sM3NMr+y78N0WhD5CZda7h31yg=; b=zgGxHBPjAuE/6b+BtHgWsw14mNo1UIxdqEGzOwG+YD+d6ryl3eBH4SZna1nJDsMext eGssi5NDpElXUspYNuTR/J1xat5U8iiPxUp7pgPO9Bd/1DzTETH1Qwi3AGNtrsnKDdGt GRuh6OJ6nJoV115OCRUU82lqGbv9ZL+piAEd7jva/d9usX5ftQ+gEbgAf9fA0MXgn1YP CwNrNuLWQVaeriuRf3oPaekOfSNjg8FDR1MGIZQXVy0DdiAYZiM/qi4cKfJTcktJLowY di+TDTzIXj72lDqR81MFHEAgeKoCI8eq/ZcgPUMgbhJOeDeKCYu5BhEBKdfVSM/sE7UR g/OA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si16384090plk.406.2018.09.10.15.37.39; Mon, 10 Sep 2018 15:38:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726933AbeIKDds (ORCPT + 99 others); Mon, 10 Sep 2018 23:33:48 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:34814 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726396AbeIKDds (ORCPT ); Mon, 10 Sep 2018 23:33:48 -0400 Received: by mail-qk1-f196.google.com with SMTP id d15-v6so15593399qkc.1 for ; Mon, 10 Sep 2018 15:37:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=hN158MWIS1t7Do7D9sM3NMr+y78N0WhD5CZda7h31yg=; b=rdzkfwZb8dqrNuaQF9xxwXs298dXYNGYIZgZ64CrsqTOOtsWnO3ucCbteXW0VEjzJ9 IOZd7wumlCIsP834QFnzR0S00jILu63wvqum3jdfhz8fvo4OsWaMkC61tpEICzkHC8Wz 4jWy9SgD9hRzUMzRNGJ9w7ImwROuJPv+XRDvGIPkbb4W8k7pvqw9jyrArbEkZ9A60JwA KwRvwZMxougA2jk1eRvoK5iRjTMW1lA8Lc7bRPB2dYqTTCo6F4Vt/hZFHHPMSbo3m3++ dT/DqhS/9QYqJQkOUDgyTitfZfazw6vqe+MpXMMMJ09b4lQHUK3btusD14bjPMvOisn5 xKsQ== X-Gm-Message-State: APzg51CQ629VgxjIXOqeR2d60KG3VbaWQ7wKfeIe9KSqJ+oKPiTWrAMB +9QzlIqJzlq9Zf2+Rt9xJNInSA== X-Received: by 2002:a37:c42:: with SMTP id 63-v6mr16501889qkm.24.1536619054074; Mon, 10 Sep 2018 15:37:34 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::42c3]) by smtp.gmail.com with ESMTPSA id s35-v6sm11227237qtj.79.2018.09.10.15.37.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Sep 2018 15:37:32 -0700 (PDT) From: Laura Abbott To: "Bryant G. Ly" , Michael Cyr Cc: Laura Abbott , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Kees Cook , Prarit Bhargava Subject: [PATCH] scsi: ibmvscsis: Fix a stringop-overflow warning Date: Mon, 10 Sep 2018 15:37:23 -0700 Message-Id: <20180910223723.25357-1-labbott@redhat.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There's currently a warning about string overflow with strncat: drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c: In function 'ibmvscsis_probe': drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c:3479:2: error: 'strncat' specified bound 64 equals destination size [-Werror=stringop-overflow=] strncat(vscsi->eye, vdev->name, MAX_EYE); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Switch to using strlcat which correctly accounts for lengths that are equal to the destination buffer. Signed-off-by: Laura Abbott --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index fac377320158..53d344d8dc43 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3475,7 +3475,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev, vscsi->dds.window[REMOTE].liobn); strcpy(vscsi->eye, "VSCSI "); - strncat(vscsi->eye, vdev->name, MAX_EYE); + strlcat(vscsi->eye, vdev->name, MAX_EYE); vscsi->dds.unit_id = vdev->unit_address; strncpy(vscsi->dds.partition_name, partition_name, -- 2.17.1