From patchwork Wed Nov 8 09:59:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= X-Patchwork-Id: 10048177 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 87F9E60247 for ; Wed, 8 Nov 2017 09:59:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6FB69292D6 for ; Wed, 8 Nov 2017 09:59:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 648FF2A4FE; Wed, 8 Nov 2017 09:59:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DEE929314 for ; Wed, 8 Nov 2017 09:59:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751962AbdKHJ7T (ORCPT ); Wed, 8 Nov 2017 04:59:19 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:45151 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751722AbdKHJ7S (ORCPT ); Wed, 8 Nov 2017 04:59:18 -0500 Received: by mail-wm0-f65.google.com with SMTP id y80so9147921wmd.0 for ; Wed, 08 Nov 2017 01:59:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lightnvm-io.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=siBTGv9IG2s3gnBMct3TisRBFvbfSCQ9phx2B0sQ22M=; b=1pTjhojZwnhFoHPaCYGcQ9Hac+vt+PcWvIrKRqQC9vwkpk2mx0JACzVxP80WeFClcK MmMSgubG9m0Q/IsyHXVWqCBC757mRyAU9spUsbJ+XHmT5VmM2jH93YiLL4+OxrNJBLRM fN+EH433L/dmE2pUG/aGldOpMFMG9pOLJFr6P9cMCuBTjhrFsOSd2leEJdZgXlgnQn1Q VUfm6poYOjYU/ZD/osHEBrtKVhoLvIGNroelf6F9QCAsRJ73/TjvO6Dl2T0RLRqvikRU PcExYPv2ZGNFAhit9cvJjER9A3WlnRzlmndDncBKTbs+GCBY8grpXLhd1nSzrvqbDC7Z MniQ== 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:mime-version :content-transfer-encoding; bh=siBTGv9IG2s3gnBMct3TisRBFvbfSCQ9phx2B0sQ22M=; b=XaTdZE7Kj630mTA9EyCVgHWsnKuqTHbFCTP+j+T6fQmyWA6qrOsUl5ncUgEwk4MXe8 eX+B+Qxtvcp0tpujYHsfVuqId30g/0Cl/XKEQ06ubE4bAZ2zyGHL3ICbnpF0RorvnnQZ Rbo3oHfgk1Gvj0o8Vfe4VnvPMnkY1oXMh/yl0esURVypJ4X8kd535jWSvM3xAwqVjy2S 75sHr/tYp4uHe1hqySoMjA9RM51ODckQXVjzgqQ+D05USCmoSGToU/Z+DD/F2IRndd9j uq1QhTaQGgO6j8jtjmRmuwGBuqbTtTEn8WRl4VMfDV39BE3S0aTZ0w7p9LikzAJWo4g8 wQMw== X-Gm-Message-State: AJaThX4UXs7qNi58ayPwCpO6Qokbt0V2zFtWc4CpMyZFl609JK1kQoRP eGJ5eAM3NU1VxioLMnQ92+6vwQ== X-Google-Smtp-Source: ABhQp+Q0vpSsuXpHC+hmxRB51ruWjbRLEVZ5Va5h42BR95v3dEOO6zonoyQ7kPnizsXNtxAtkOk+yw== X-Received: by 10.80.151.21 with SMTP id c21mr2931572edb.47.1510135156687; Wed, 08 Nov 2017 01:59:16 -0800 (PST) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id h2sm3271666edc.89.2017.11.08.01.59.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Nov 2017 01:59:16 -0800 (PST) From: "=?UTF-8?q?Javier=20Gonz=C3=A1lez?=" X-Google-Original-From: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= To: hch@lst.de, sagi@grimberg.me, keith.busch@intel.com, joe@perches.com Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH v2] nvme: compare NQN string with right size Date: Wed, 8 Nov 2017 10:59:03 +0100 Message-Id: <1510135144-1557-1-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González Copy subnqns using NVMF_NQN_SIZE as it is < 256 Changes since V1: - Fix commit message to indicate that it is a copy and not a comparison. Signed-off-by: Javier González Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/nvme/host/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 37f9039bb9ca..b3bc9fb39a6c 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1744,7 +1744,7 @@ static void nvme_init_subnqn(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE); if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) { - strcpy(ctrl->subnqn, id->subnqn); + strncpy(ctrl->subnqn, id->subnqn, NVMF_NQN_SIZE); return; }