Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2222988imm; Thu, 18 Oct 2018 10:57:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV62TGkkoWKHTcusCOBrvyYRhySo/kSyOUjxoASo3bp350I2Rc1WJTPjpTwtxp54kPHL25Klm X-Received: by 2002:a17:902:64c1:: with SMTP id y1-v6mr29787481pli.301.1539885479251; Thu, 18 Oct 2018 10:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539885479; cv=none; d=google.com; s=arc-20160816; b=LnCp4gPVz4/kakXgGiyVksvUpcmMRCQutrfOCt791k3inP5KK5CJwjYmqT9P1m4GUM 7Lny7MMoxdh64d2FxbNza+s05Lto4IIHgNts4QUtX7ncwFRuADt0hrqVuBae5ysUFJGO 5Nwif/hEWNV2VU4HAjHvTH3/qvBwuwDO3im0IclDgtRg5LYpf1DECaI/LUB3Ryyas/J3 aHHWkPs/++ZO1s8WpmLuksBlcvRXWlZe7cFGyfnXJ1CAtkwEdiN6UxuVv6TZBbdWWtEc gVoaOjwbbXoxKw3hw/pGB88tid4KehZEv8lvMDV05lSSitYhcPiM1gnnUB9eZ4ErTfe3 9I4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Osqt4GljdYehQOUcHahrxDVmKtlOkSLlv0td9QNDVIE=; b=DU3HwJtZa5xydzDeKFygYmzN9YZk9xoRilKMHXA60m8OEtryOQpwa4vEvvi3qOgxKM f+RCotcuDpE/5hE24N+rh0J7wWfoVMq30KMEygXgpdxWcy7ylN12NbDTmsdcykga/bga 6lvSYzY/3zkfmObdnaqdDT4ignsTiWjG8god91ait9mbiHiuC+7YL4kVMqVX+hW5RhHc w7BwGdT+6XwrmgcWR8QoUVsm7bWXR6xnID7sTyt8NO87VKkxDYUcMTBOJzuATB1aGADR x+78c4lVpwzKT2ME5FOPhuyn8JqlYfrF25OxPvLgitt02BaGX7QE3UFTxP8bz1xIK1QF j28w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fAz8Guo5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si20646199plz.380.2018.10.18.10.57.43; Thu, 18 Oct 2018 10:57:59 -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; dkim=pass header.i=@kernel.org header.s=default header.b=fAz8Guo5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728662AbeJSB6r (ORCPT + 99 others); Thu, 18 Oct 2018 21:58:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:46470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728406AbeJSB6r (ORCPT ); Thu, 18 Oct 2018 21:58:47 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7FA292145D; Thu, 18 Oct 2018 17:56:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539885402; bh=nwPl+ERoeQNOXw00TmbwAzwtPNCde7RNbEXMqjWCaEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fAz8Guo5HTY2RNux+AuP9CsbCNRl88WE6zmJp0wjjo72zisZDPD2JistOFIAHMSlB U9h/u0iyL2STsOzrJxqyfHcBJDv6xnhd39nIDwVhy0tAMGaGoQqMYlg2gvm8iGOCX9 TFpc0Qb62G1x1AKZWAXL42qunLGTWd2aowlUKbJU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laura Abbott , Kees Cook , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.18 18/53] scsi: ibmvscsis: Fix a stringop-overflow warning Date: Thu, 18 Oct 2018 19:54:11 +0200 Message-Id: <20181018175420.039110087@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181018175416.561567978@linuxfoundation.org> References: <20181018175416.561567978@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Laura Abbott [ Upstream commit d792d4c4fc866ae224b0b0ca2aabd87d23b4d6cc ] 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 a single snprintf instead of a strcpy + strcat to handle this cleanly. Signed-off-by: Laura Abbott Suggested-by: Kees Cook Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3475,8 +3475,7 @@ static int ibmvscsis_probe(struct vio_de vscsi->dds.window[LOCAL].liobn, vscsi->dds.window[REMOTE].liobn); - strcpy(vscsi->eye, "VSCSI "); - strncat(vscsi->eye, vdev->name, MAX_EYE); + snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name); vscsi->dds.unit_id = vdev->unit_address; strncpy(vscsi->dds.partition_name, partition_name,