Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4468442imm; Tue, 11 Sep 2018 12:23:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZDgEeXc+wTRVTsrw67R/PspX3fBORiSS8/wLo3zaw6XlcFhUmFwU3lQ3IbQvLRuIA9iZx5 X-Received: by 2002:a62:1f11:: with SMTP id f17-v6mr31210979pff.168.1536693782796; Tue, 11 Sep 2018 12:23:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536693782; cv=none; d=google.com; s=arc-20160816; b=m6wPi+IFHPGdtiVlphg/bbxd4cbIJcecOvzfO/KW++3RZ5ZaAYJM7QDl7S2b8v7gAc aex9gHcAmvmm8XDVnhCwJKDrpznuwgK2FzjsJnEMWm+5lh/++5WcvQ9wlhCPrf9W3TvF d6zloW8Tx8et+ZSNrauHn6caX1PvzTRys++UnVdy9fn8iDhwVFiau12DRiaTHPmoWqNr r4mebAQqLwrKr/crFjGT4Km8qqTwtEpabw5UQ2ZDEEe/6GxuDbVGL0HDhq7PPOb5MYKA LDbNzhP1oOO0ReQ6Ayv6sukLEJgn/tj8D83gmYmvqOWSGMXFnZ4pXCzb/ae17CXPQ005 angA== 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; bh=IYDLXOvqXi5U1MpjfZDRh4TELVkjnKkN4SnOhEmKxyU=; b=sEfDTLWu/gvNQHUhzbtAABJvbDo+qgpucB0P4aSOp+jg5dFKSAuvhinVwuR6sXyt0T ZCHXuE15TzXo0BmAPmMCb0BcfQwIncgL5wei0NIijU8tqcCGm/9X64T5O9Xm+2+9D8L0 I/92dS/aMaZOCquV8RIq6xQLxQgmBDYQAgSlEvdAkuOHraxvvv2F7Kj6PPy27W88qS4b ZVC3NofeIEGzgpAJwPkHv9PM5Twnde8dgcbjzD8OzkFJR4qM6TY6bgBZiXDMywSlVYZ5 pOHzVGkWLMDgxdDeihXhEEHP+TAJIsNboDYSboXyCIQSN7+ZgWeiAMl5ia0ziksgbTKV utyA== 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 a2-v6si20877724pgh.396.2018.09.11.12.22.47; Tue, 11 Sep 2018 12:23:02 -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 S1728184AbeILAXW (ORCPT + 99 others); Tue, 11 Sep 2018 20:23:22 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:46469 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728068AbeILAXV (ORCPT ); Tue, 11 Sep 2018 20:23:21 -0400 Received: by mail-qt0-f194.google.com with SMTP id l42-v6so4206667qtf.13 for ; Tue, 11 Sep 2018 12:22:37 -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:in-reply-to :references; bh=IYDLXOvqXi5U1MpjfZDRh4TELVkjnKkN4SnOhEmKxyU=; b=c3hIiSPzlNMvsmnI28fuc14RvEgqw9P52t3cxEUAwkykcrK3hbLiSQk9WY5G3SKKWJ qajhG3E30ay0HxSmjloMjKU9cfCe2obOrME4dyhx1v9FgquqC8ORlaSWE+x1iKr/2kyL X9dWO7ZxaaydhEZE0hCCd7JmeaeksMKxXFgfGWBuniQvjk0A/3EQvxvvHRGv3wAUX0Il 2HpOfRm3tSSA6eHsv3agJJ5tQhul8S4owGCnNeBCQcmjNfea+dTkO/1STRbR2aDqD0d/ mzfqm+WzP4PVCX+24UszJAzGvI9YqIaCS5DAuh/tx711KHOumyL/B7AGEMEHD9cKI+8x JFzg== X-Gm-Message-State: APzg51Dnf5hUzZtl+QDcct/2xU/tM20pVo4kQf8wE5Ql2NR7AsfR1eep QJrz7OQCi8/8uKagDVy1xftCFA== X-Received: by 2002:aed:3c55:: with SMTP id u21-v6mr20941353qte.198.1536693757296; Tue, 11 Sep 2018 12:22:37 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::42c3]) by smtp.gmail.com with ESMTPSA id g14-v6sm13639452qtc.66.2018.09.11.12.22.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Sep 2018 12:22:36 -0700 (PDT) From: Laura Abbott To: "Bryant G. Ly" , Michael Cyr , Kees Cook 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 Subject: [PATCHv2 2/2] scsi: ibmvscsis: Ensure partition name is properly NUL terminated Date: Tue, 11 Sep 2018 12:22:26 -0700 Message-Id: <20180911192226.3620-3-labbott@redhat.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180911192226.3620-1-labbott@redhat.com> References: <20180911192226.3620-1-labbott@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v2: Switch to strscpy instead of just strlcpy --- 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 b3a029ad07cd..f42a619198c4 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3477,7 +3477,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