From patchwork Mon Sep 10 22:37:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 10594827 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 3FC6214E5 for ; Mon, 10 Sep 2018 22:37:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27D7C29079 for ; Mon, 10 Sep 2018 22:37:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A57D290CA; Mon, 10 Sep 2018 22:37:36 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 A799529079 for ; Mon, 10 Sep 2018 22:37:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726782AbeIKDds (ORCPT ); Mon, 10 Sep 2018 23:33:48 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:33424 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726426AbeIKDdr (ORCPT ); Mon, 10 Sep 2018 23:33:47 -0400 Received: by mail-qk1-f195.google.com with SMTP id z78-v6so15549794qka.0 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=kQ/6+Y9scB+48gpKyfIBxckJrIUtj8KqcYdt8s/+Kc5+binF5+QBW+K2/Oy4d7zI9w cf5PrjsQFlDfu1vKkz/B2Cc6BN8Ew+wY70JgrGeGmW9UnzjG51kQNGvYLV8kQdC8Q2N1 1srbCrhuakX5PLSMXljSvEbkVY/kH0FPc+hIp2uQPBaipjdes4kKmTqwzx088AttBLRI Pa6MrM0HRCKxskYJtfqXlT6+LkykGdw4csmHUIj4r3Khidz+fKyiyrk10BBs7hI1ytq1 NMSQAVjFt6YFluB7gNUXXR0sZ0w12emdC30D+LF8Cw0qjoPLVz/MFv1rK+LW+3wxGOxR ffSw== X-Gm-Message-State: APzg51C5dUOe803izj1Ok3uVjle3/YLThZ2je/pLdaoWCXotalCk7cZG Ca6q7Di68UXm30g/asawE4mYVA== X-Google-Smtp-Source: ANB0Vdbb816dTN99lR2XJQ+FDdXeoE4CXi4dpqPZol3/2NvpIW33HbM/QGb7APBPLuvRd1cLFP9elg== 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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,