Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4402090imm; Tue, 11 Sep 2018 11:17:18 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZILTjFLjQ0X0GJC55phHGfPWGGCntEjzRKWpPdgFZRsTkN8X2RhYFHXfOTP2Z1j0eZJJRj X-Received: by 2002:a63:f14d:: with SMTP id o13-v6mr29394152pgk.236.1536689838329; Tue, 11 Sep 2018 11:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536689838; cv=none; d=google.com; s=arc-20160816; b=vAldbJQMIVqGOnFJLloDQ/HXtNzZPEHRu2dePfCHdB/NPMDaLw/hMjMVpJ5YPQDHrn IdlcK7lpYWqjveTaYREAdZLh6RMKOKnAxQwBYETA0dnmIHvo9p1ni3inQQXEoWr2VBQ4 JKJhLLBFyYaGtpLVd/2GPdhMOqQM+xP8Xbj69G2nDy1BscdfnfnbFh6+8xZ0ocixyxqF tpbj4yrOu355qPGXTF04Fa3NnXbMjP8FEFZX2bsSVYgtUDYqnfThCEtmhrmkFe+2V+qk Lhyo2mCnkOZCOtX97cS1YODD0EU/KcChBjmgQ53Wj1CHG3zlJe4ozrhZYIwj9qqxnGlD wfyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=A743d/wM/mljAAT/I+NbjlnB3etN4k5o3DxXuJzTTUQ=; b=rDpenqA/Dh+vxfkRv+gshNM9pF6N8Oooous75YTHV/0xpoL1m3Ff/6WJ/s+Z4Y+0jq 8xrfohb8nbV8tAXOpJoHa/tzrwQA0OGa9BfEakeoti2Z8cS9u4Xi/PZP0sOaGbDun1FW wzH/KqqgVmN5/KopSySvaG0oKD9lHjAGHKifx42aQ3rXI1FCXVUfTgNF1/X/WJMyNict lnNrGitOgIjnedQ3GcQNNKdMM5cbywhSiUs2J9bsJzblctZQK3XtROLxBuJ4h+hMoWQK +u55e+FUNvXqbs8jwN8O9IZWc2sxX8BcvM1FXgf0ZRq+z0qLUqh1bF1dcaWvGQJsRI6D /tRQ== 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 v4-v6si19990641pgn.110.2018.09.11.11.17.01; Tue, 11 Sep 2018 11:17:18 -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 S1728106AbeIKXQK (ORCPT + 99 others); Tue, 11 Sep 2018 19:16:10 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:37177 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727332AbeIKXQK (ORCPT ); Tue, 11 Sep 2018 19:16:10 -0400 Received: by mail-qt0-f195.google.com with SMTP id n6-v6so29241520qtl.4 for ; Tue, 11 Sep 2018 11:15:40 -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=A743d/wM/mljAAT/I+NbjlnB3etN4k5o3DxXuJzTTUQ=; b=Ree7eCVaO/XanyN5IrEZQb/nJ/bE6SKi1KB+UnGu3FE38CN/wEorFYcp57I2sbH1Mr 6EBF/+DM+ALFnxRuXv1RIQfYaqjNaxJd7A5Gc6ijl9C/9mQeXlnVuknwzS0FLnJLHHHX 1DMunoWiKspl+V8jD+AWjyV/XwMBqASlN+RrHpaZXGGXhs+0Fi6YJPqpfOq6Ct3zHF8s y7ELPsXNl8N5nZzwqzCXCLw+f7+oYjqVcCCaVrWqxc8Z+bj4Aa1TcaZFS+uZi95m73yt Mz0U15tXReQCmlF2yGJmmao2RLHB7I3gWDqMYRW1lQnTYQuLTFCKZvT1CnH+y+Ln3yGs LwoA== X-Gm-Message-State: APzg51BeznCXhJQtdN/ncgxm2DNZuoWGqZpuEJyutQip+/spaZGSkCNI A/9Yvr8epRPTCHtizceXdSgILA== X-Received: by 2002:a0c:c969:: with SMTP id v38-v6mr19726328qvj.192.1536689740060; Tue, 11 Sep 2018 11:15:40 -0700 (PDT) Received: from labbott-redhat.redhat.com ([2601:602:9802:a8dc::42c3]) by smtp.gmail.com with ESMTPSA id 62-v6sm11813115qkx.66.2018.09.11.11.15.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Sep 2018 11:15:38 -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: [PATCH] scsi: ibmvscsis: Ensure partition name is properly NUL terminated Date: Tue, 11 Sep 2018 11:15:34 -0700 Message-Id: <20180911181534.18553-1-labbott@redhat.com> X-Mailer: git-send-email 2.17.1 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 strlcpy which does this safely. Reported-by: Kees Cook Signed-off-by: Laura Abbott --- I realized looking at this that I probably should have made this and my previous patch a series given this has context depending on the other patch. I can resend if the scsi maintainers want. --- 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 9305440a00a1..1217bf2a28db 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, + strlcpy(vscsi->dds.partition_name, partition_name, sizeof(vscsi->dds.partition_name)); vscsi->dds.partition_num = partition_number; -- 2.17.1