Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4468728imm; Tue, 11 Sep 2018 12:23:21 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYoMv37NZon14O0YQWioiCEbEMFosqAsAFsPE42KaUbjviav33xF/WNVsot9TOS9V9ODeAZ X-Received: by 2002:a17:902:29e3:: with SMTP id h90-v6mr28793672plb.215.1536693801191; Tue, 11 Sep 2018 12:23:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536693801; cv=none; d=google.com; s=arc-20160816; b=dLUbstTfuNZAJB4le6qEWOoexgYthmwQuqGoH15DG/PKWZ2RWOLoZLoUoy/WfBCjEp EyiaRMRFeqo6sjMdR+kX+OTz+m/SmJrCpjKE12zSYhnsiQEK5J4V/rWUbLAQwkiPO4Ye Nnk80vHYjhKx3/v5bHsi+kvbRh2A7nfunG2P6NoAtNkhMsagh2OLcnDIGOWIcqswaMGZ lM30ZpOeOgeh6zlOo4z7TXYqIXHUs0tDVmUg8V5fE787NhJ0Yil+OvLC3j82mpl6hDtM UfulmINS752VBckjGorulw1ohlGIHuWqTY12JJHL9CdPvzmY7DJB2eXapWMCeL1LvXW1 Kq5A== 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=ta5tHOBMbSYoicbu0+CPW7rTPB5krKblxPmZPIYaX7A=; b=RiRQCZNntwAU84pIprw24n3z1ZyohJNoF/mFZv0AP3dGl42oNs7jtP7KvxbJANHj5T w54XGCfSf/zu0Yy6DOlWBhgpkP6d70rTHeiNBa8zfh7BCa5CsSvtTPLj3lWKd2bmqqCG kvUbxRYEij9vrk7Jzk5j9EvgCdTjDQUU4QMkZomzoCcTK7feqGls7heiQBP+6vlpztD8 l+L191dcaeePa00ktBAwsQ2nU0XoVn5SiaBVnb8jYcqThyJSZqsWOaLBKxLTfZX/Icrk bm9Z48Nx0O4vSewoIF0PIeQ8u/QKcN/uU6jun0S/iQSNmiBxVs8ivVOMGVs3sy6Ihlq0 IHUQ== 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 s26-v6si17596165pgm.531.2018.09.11.12.23.06; Tue, 11 Sep 2018 12:23:21 -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 S1728071AbeILAXU (ORCPT + 99 others); Tue, 11 Sep 2018 20:23:20 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:43432 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728068AbeILAXT (ORCPT ); Tue, 11 Sep 2018 20:23:19 -0400 Received: by mail-qk1-f194.google.com with SMTP id 130-v6so17526699qkd.10 for ; Tue, 11 Sep 2018 12:22:35 -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=ta5tHOBMbSYoicbu0+CPW7rTPB5krKblxPmZPIYaX7A=; b=PVDW1tLDyGpO3rcu8s+40tq/EuqrNMOh6Vt8bX3uqyUBBdYlfAihaipSo7Ixw6S/bB rq3yc2c+rnNrHgGW9q0iA4FmbGBqXN4jEQ4X3IW/j9dmoRUWHvG+7LMirKXo9FaY5Twb D0AwE2sAvkI2LV7980JkZAA1/lIrqw/T+OlSedWF852P0aRPH4OJZf0dSJhvZMBb88Jj 8S7CpmFVAw0MGPqp0LVWg3TMo6suTjtehSmJmh+5IoTaYs9SEzWu8UYJTn0dX9ST6grm MZ8+JfLdbQFyEIaXoJJXKQJDI8kV8g7eypUk4beqabeldKzp3tsNHhXYQ8y8NTsAB64+ bz6Q== X-Gm-Message-State: APzg51Alq/k88aVDe/8TtfmfWxfgwYJAtvfpC8GVBbale0ZeL9JPTErt htOfnf1n1hIHax/hnrytrjJUazy95yk= X-Received: by 2002:a37:1414:: with SMTP id e20-v6mr19562943qkh.88.1536693754793; Tue, 11 Sep 2018 12:22:34 -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.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Sep 2018 12:22:33 -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: [PATCHv3 1/2] scsi: ibmvscsis: Fix a stringop-overflow warning Date: Tue, 11 Sep 2018 12:22:25 -0700 Message-Id: <20180911192226.3620-2-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 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 --- v3: Make sure there is an extra space in the partition name --- drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index fac377320158..b3a029ad07cd 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3474,8 +3474,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev, 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, -- 2.17.1