From patchwork Fri Nov 3 10:02:49 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: 10039767 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 AE6536032D for ; Fri, 3 Nov 2017 10:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B10092958A for ; Fri, 3 Nov 2017 10:03:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A5AF72958E; Fri, 3 Nov 2017 10:03:38 +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 57AAE2958A for ; Fri, 3 Nov 2017 10:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754185AbdKCKDg (ORCPT ); Fri, 3 Nov 2017 06:03:36 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:55173 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755920AbdKCKDA (ORCPT ); Fri, 3 Nov 2017 06:03:00 -0400 Received: by mail-wm0-f65.google.com with SMTP id r68so343816wmr.3 for ; Fri, 03 Nov 2017 03:02:59 -0700 (PDT) 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:in-reply-to:references :mime-version:content-transfer-encoding; bh=8aQOxU6W9R7ujTdtJQBfLk70PfviqoPpIXiQJQpRoXw=; b=XY4W3Vw+YzmoKgQsCcs31aF03ikc4xr2fW3jQUJbJ9utNwPDpfylswzYNBPMIYN0/q oHnioBV4L2QZqG4123rF4QZNa5C1Nlj2WygF7i6NazlmF7eliKw5vV3skrAQrMuCddNg FmoFJ5zthxvj/e2zwtDboyqQEZu2FuFpehB1A1b74he8tkvqjXEV7CAqwRDvoMNS44zG FM1NuLmy6f1qNauNh6AMgiR1IAG4BR/6WU9jfBl80xYP9FDEB/m6lXxH/ZSZ+8B5JlIL O3C5UkDSrgKUODP3+pJtXwS7d26Tx++B4+akWdMdUck6Qf+UzIha7wSZ9JNwX6lw6uqR bBOQ== 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:mime-version:content-transfer-encoding; bh=8aQOxU6W9R7ujTdtJQBfLk70PfviqoPpIXiQJQpRoXw=; b=KekjmQFzxrtv7cOJQNFDvwJVGJJRwkJ+t9qgV+V8eIXP6aafWWDWqRA5dHAdm65nfw MrYs0p4woLJA4MPxKQ4Pwaub7XYa43ja8qZdJwTl/WsTBDj2qTVccIIcrTeVn1DwpeF/ icnjuOI33hPUKB5vt/XZHwlGH5bL0cdaouZYuZgnpvj/pxhSugL5afQy7Id+ah8h1u54 hllskyEN2DQAfLT6PlSncdaGOirugFqEOtKEglUgMpUIFkd+SIYr8yDQWR/tl+rGD8i1 yFd22zzvMu34E55wCPNXqp3zQB8ezlszfGEnzHPVc8vVacBr05teVsK2X3MXjZD+whUH Xwag== X-Gm-Message-State: AMCzsaWDS38LgKunqFTNbE0tjn0WqrPI583M2IPULUs6JnJ7hmO6g+mU 8TBQTlOLxDtSzxx1ksMkOndVBQ== X-Google-Smtp-Source: ABhQp+TiNGEAud9Ob0fWF5TvAWzCcrhY1BVm01EsVPFdVVV1YzC6EkJNR0gz0SdBDCWSNrUH3UmmeQ== X-Received: by 10.80.183.193 with SMTP id i1mr7948183ede.167.1509703378917; Fri, 03 Nov 2017 03:02:58 -0700 (PDT) Received: from uHalley.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id 41sm4837530edz.66.2017.11.03.03.02.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 03:02:58 -0700 (PDT) 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 Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= Subject: [PATCH 2/3] nvme: compare NQN string with right size Date: Fri, 3 Nov 2017 11:02:49 +0100 Message-Id: <1509703370-20379-3-git-send-email-javier@cnexlabs.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1509703370-20379-1-git-send-email-javier@cnexlabs.com> References: <1509703370-20379-1-git-send-email-javier@cnexlabs.com> 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 Compare subnqns using NVMF_NQN_SIZE as it is < 256 Signed-off-by: Javier González --- 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 bd1d5ff911c9..ae8ab0a1ef0d 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1743,7 +1743,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; }