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: 10594829 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 DACEB13B8 for ; Mon, 10 Sep 2018 22:37:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB7B029079 for ; Mon, 10 Sep 2018 22:37:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF7CF290CA; Mon, 10 Sep 2018 22:37:40 +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=unavailable 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 7EAA629079 for ; Mon, 10 Sep 2018 22:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbeIKDds (ORCPT ); Mon, 10 Sep 2018 23:33:48 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:41322 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbeIKDds (ORCPT ); Mon, 10 Sep 2018 23:33:48 -0400 Received: by mail-qk1-f195.google.com with SMTP id h138-v6so15531492qke.8 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=MNT/UdQ3AVZBH3di5taaP84vDryDXAvXrnFhwsS6Y763xDUd8bt2B+doyjPUZPrG/a CFJRtLQlwX9odpe4/rPtAWmBeiKmLq4LWaqX+4TMYIgkZLl5cUZRviNOMHeormhBtBcS 9wOk8Z5Da0NUnStw3m8iV2XDXwLQ5I9xQdZuLdlLPSH4IcQ/YCsEGfdEMelRWNJ4EPAg Fx99jbRe6eJujFAxQece2Iszcglrmyc5ciys5hc+jXzE4Qdh/9EYvAZvV/lH1hTBw9nz kxcWMsdZ9mXmaqqbvmisgMvh+pk13Ez6jwrRWbrbUsuMeFMb/gSCG+lS8E+YMC21sf9m e0lQ== X-Gm-Message-State: APzg51DBQSbKeb181TiVaqfe4Jo4Xsch5QHXAhEITAciCWVND+lVuooC CXj+cG0a88u8Ww6DJ7LnT5BS0w== 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: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@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,