Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3730342imm; Mon, 8 Oct 2018 08:37:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV62wKIxfeoB3oBgpSAcnTgteByWH8AAgdUWQesimZItfxPj0sf2SoeFVSQh/Ngr8pEKBiK2i X-Received: by 2002:a62:1551:: with SMTP id 78-v6mr25574242pfv.178.1539013066571; Mon, 08 Oct 2018 08:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539013066; cv=none; d=google.com; s=arc-20160816; b=eUzyiDUloBR32g3GmaensNcu4oetTsa4tTWXukwSQq3RIfSyd2qB6h5sc2Oe/KYEAx tVC6o/yyqa03N1MYSQskjFE+WHR1ktbjpVYDrm9nXA18fMOUHO9PznWTRbi8ZbEq08Ln nUVobNQxhzlsg9Z6MKKRWvtMC9MVkOMGL7KGDi9ih+TJqsXAYIwwtAzGq5OvKVHhceDa S5JMHEz27jlQoS63OpkgFb74eqkdX+Qbnf97GxRevPOX7hBRGJbiVMfTf41MqTslsu9J eKpiRVx/BRvRJDIA3Vu6T+/3Csy4hpRHeuzaV3g4bPL0GwjoVr/+PEpcEXZPCNBNi2YW A1lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FGqqHlILDfZqnkxge7cNGoQHnK74/uBk8jjdwiSFUvo=; b=gYx8yS5pqyqiKLIg71YZhICUt0WRNOHKXoIEwy0Q5mfgMS4SKv597Bj/atL1guQqNz cj3dxZ/RjeF8nAiICQGPUEYPDEZiychL4lbyBqAadWZQkqeGBsWoV1vk0OeFztQT4v+7 LkxmXk+rs2ZpzOUvUXhmPEJEXHM2jFVVjEM2VCADvGRr5YSreG7DttxMvmTd9NZwssSj XwnGFDntA4+k2VFSjljFA5wujVFWiOMkj+bz10d5X2tsqq2PlXO2l41abRl7ltAr70+u dLllPkHtXufNTDhnFEyMl5BtM7dCrn9zBY2kdmIwynbctb8xP4XGDWiLX7nt4Ytp/lFH G80g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SeKNmfv6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11-v6si18080362pgj.276.2018.10.08.08.37.31; Mon, 08 Oct 2018 08:37:46 -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=SeKNmfv6; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727735AbeJHWtp (ORCPT + 99 others); Mon, 8 Oct 2018 18:49:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:56202 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726977AbeJHWiA (ORCPT ); Mon, 8 Oct 2018 18:38:00 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 79E9C21508; Mon, 8 Oct 2018 15:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539012346; bh=sR3Lr+0lVpha/GBqZZFq5yugh34NGuyHEQMuvlRl6a8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SeKNmfv6vJKWjnSzHNp6WIySQj7pDeT965fJdFytT6wSl1pxtlF8kvJ615me0Hpc5 wxQFN4GzO5JSZTs5Kt12DmPOHH7JsMVKMTcefMjePM+4JPl4zW4B8UZuDi3wHp4qCh CNPhNk+kSTZVlQXntDdqjxv6W033cZX0kkWJpjcE= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Laura Abbott , "Martin K . Petersen" , Sasha Levin Subject: [PATCH AUTOSEL 4.18 20/58] scsi: ibmvscsis: Ensure partition name is properly NUL terminated Date: Mon, 8 Oct 2018 11:24:45 -0400 Message-Id: <20181008152523.70705-20-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181008152523.70705-1-sashal@kernel.org> References: <20181008152523.70705-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Laura Abbott [ Upstream commit adad633af7b970bfa5dd1b624a4afc83cac9b235 ] While reviewing another part of the code, Kees noticed that the strncpy of the partition name might not always be NUL terminated. Switch to using strscpy which does this safely. Reported-by: Kees Cook Signed-off-by: Laura Abbott Reviewed-by: Kees Cook Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 95bf381413e8..ada1ebebd325 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3478,7 +3478,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev, snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name); vscsi->dds.unit_id = vdev->unit_address; - strncpy(vscsi->dds.partition_name, partition_name, + strscpy(vscsi->dds.partition_name, partition_name, sizeof(vscsi->dds.partition_name)); vscsi->dds.partition_num = partition_number; -- 2.17.1