From patchwork Sat Feb 6 03:36:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minwoo Im X-Patchwork-Id: 12071861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A105C433DB for ; Sat, 6 Feb 2021 03:38:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A8F7964DFA for ; Sat, 6 Feb 2021 03:38:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A8F7964DFA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:56020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8EQg-0007as-Ax for qemu-devel@archiver.kernel.org; Fri, 05 Feb 2021 22:38:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8EOt-0005qO-Ik; Fri, 05 Feb 2021 22:36:47 -0500 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:52258) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l8EOr-0003ha-8R; Fri, 05 Feb 2021 22:36:47 -0500 Received: by mail-pj1-x102a.google.com with SMTP id q72so4667327pjq.2; Fri, 05 Feb 2021 19:36:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Tba0cycsltwUC73PsTkrnovi7914K2kfDYRvppj6aFo=; b=XPlsnorcMY8zpRVO5amxQIQ7usNTwiTabNgXr6YXkAmd4xZZwP9hihFseqg11VylCQ l6V0HqTGKNqS4vOXtJgHUijNBwqVxsMcet6V6+gzCdJzAybkcv3/jhywpAjZ0OqUyv3Y MVGgrmm8smadRpnM9E2XwYxjV7EwJPSqlllRCzHURZPPUqSW1mdsIIdBeSjE+THj+hX2 G44kJKwVlv6lEySxc6JRxuMIEIHGYaS6hdzovGxKEXcwPugdKlt3cxgYTWIfgtMSbf+T roxB7dPZJO16Y/g+nul9K5mJwYnqzG3Hb+YEI7wdjD8gCOTkej3aCV4t6Ri9ZGCR6MTq PzOg== 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=Tba0cycsltwUC73PsTkrnovi7914K2kfDYRvppj6aFo=; b=T2HMG637obRpGJsHu//9sQtzN+gfA7pJnCaUgWyPP2EksYmaXnN+uzO3Sc9TiD65YW CyxAJFgPoHyQez5g2Tu+geyy8vOZDnB6v97hVCHShZ6XQmEbi4/i/tZ6C9h5JYHnOSfR 9ei745Yk85HkElQ9FnpC3sX7kfAxW+8E0AQc7iCkF1Sy4iS12YjkrAUgPpkgklCxiZPZ Z8YF6/8zZydnprdWa63AbOYPPzm194kUqbxgGoxsRKeL8f4f+KOZcXebL8gSVXQ3kop9 Ig6zMhBwaqXd9k2rZ0/2HGlgbUjm8M4F535rDL13twAtZxX0s4YhxcgwTj9fPrfCiOyG /ehw== X-Gm-Message-State: AOAM531q4m9h9b4SoMR6AgGO8DuHVaUJVFuB/QNw28E7Tl/BBwEjzZl5 rR4tE3q530T4zCBVHM7WnBDat1t4U5uqKg== X-Google-Smtp-Source: ABdhPJyAUvFqCTusu6uEQNoAADYvptL2FfzD837Gji0pkkKaN2kpN0ag8wlqGt0T4PWl+6peY5SLow== X-Received: by 2002:a17:90a:4a0e:: with SMTP id e14mr7119834pjh.200.1612582603441; Fri, 05 Feb 2021 19:36:43 -0800 (PST) Received: from localhost.localdomain ([211.108.35.36]) by smtp.gmail.com with ESMTPSA id j17sm10862375pfh.183.2021.02.05.19.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 19:36:43 -0800 (PST) From: Minwoo Im To: qemu-devel@nongnu.org, qemu-block@nongnu.org Subject: [PATCH 2/6] hw/block/nvme: fix namespaces array to 1-based Date: Sat, 6 Feb 2021 12:36:25 +0900 Message-Id: <20210206033629.4278-3-minwoo.im.dev@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210206033629.4278-1-minwoo.im.dev@gmail.com> References: <20210206033629.4278-1-minwoo.im.dev@gmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=minwoo.im.dev@gmail.com; helo=mail-pj1-x102a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch , Klaus Jensen , Minwoo Im , Kevin Wolf , Max Reitz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" subsys->namespaces array used to be sized to NVME_SUBSYS_MAX_NAMESPACES. But subsys->namespaces are being accessed with 1-based namespace id which means the very first array entry will always be empty(NULL). Signed-off-by: Minwoo Im --- hw/block/nvme-subsys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/block/nvme-subsys.h b/hw/block/nvme-subsys.h index 890d118117dc..574774390c4c 100644 --- a/hw/block/nvme-subsys.h +++ b/hw/block/nvme-subsys.h @@ -24,7 +24,7 @@ typedef struct NvmeSubsystem { NvmeCtrl *ctrls[NVME_SUBSYS_MAX_CTRLS]; /* Allocated namespaces for this subsystem */ - NvmeNamespace *namespaces[NVME_SUBSYS_MAX_NAMESPACES]; + NvmeNamespace *namespaces[NVME_SUBSYS_MAX_NAMESPACES + 1]; } NvmeSubsystem; int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp);