From patchwork Wed Mar 15 11:31:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A . Shutemov" X-Patchwork-Id: 13175673 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50A00C61DA4 for ; Wed, 15 Mar 2023 11:31:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9FAB6B007E; Wed, 15 Mar 2023 07:31:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A50A66B0080; Wed, 15 Mar 2023 07:31:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8A1FD6B0081; Wed, 15 Mar 2023 07:31:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7C1BA6B007E for ; Wed, 15 Mar 2023 07:31:48 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 517501C68AB for ; Wed, 15 Mar 2023 11:31:48 +0000 (UTC) X-FDA: 80570917896.30.E914F73 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf06.hostedemail.com (Postfix) with ESMTP id C335418002C for ; Wed, 15 Mar 2023 11:31:45 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lZ7XmTP2; spf=none (imf06.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1678879906; a=rsa-sha256; cv=none; b=mH/wW92bKQ8Oj8rdHsSaVfYapDlyWfqSMAcpiDTG7N5j1a4qHfAHYyshWT+r2BwnHhk2Z7 D8mrLLtIUPgdc5tDhClaID9gGK4TaMjxnYrWMpXiDax9sHMiggE1zqzKyM7rsRUAI7CVF5 oMnU5EsUy/5B7wWjSc3RGs4vp04+dSA= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=lZ7XmTP2; spf=none (imf06.hostedemail.com: domain of kirill.shutemov@linux.intel.com has no SPF policy when checking 134.134.136.65) smtp.mailfrom=kirill.shutemov@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1678879906; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=U4pgMkKqMw8kMXqqLc84IGGloFN7AbtYOBFMOlaSdh8=; b=TyNUqPzq/1QTyXcXNTpCKTsURDlv67BDRGSj9U1dXaApjhnEzw1hKEwJe+gFcg0Ircksfv b+Z+AUM6vX8b20982hMo/CyX8gHqZNjSL/LtW7pWjM/jf3WpdmF8dR3e+9F4pOlROfcrA/ hHe8mbO+NQph/OHZSZrgQnPlHLIl3Jk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678879906; x=1710415906; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iwb00sFFSTPogcirxHway05JjoMe28eGhip2vpTL5qE=; b=lZ7XmTP28wAiiSjpSBx+2QAITH8wknB8Lwbq5TzOJnaNpkalG9kJODXp qFxTGDD6HDhDdkbwclJjd3MeKBm4uU0dLzGT4dzoJScPxuWfKE5R12cqG xrjbxyf//MStv7ShPPC1/osSQr9kmligNSSLGjzKNx0cBgRuotcnR247K LldT8yGt7NdwlpZNFmeZAUBjquZhMyvffMHyUljoQbQiYKTUlmxsneXaK z4at7DlhkSFM49DRuaF1E2FpByywTIiFC0qYQHAbCCTwJ3MzK0S89oQl2 Iet4vqzQx+hSjgZNIoGr/Sw0WVZXTHkwJsz294rLxbAaPC2+54xrqm71h w==; X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="340040104" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="340040104" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10649"; a="768456009" X-IronPort-AV: E=Sophos;i="5.98,262,1673942400"; d="scan'208";a="768456009" Received: from nopopovi-mobl1.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.48]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2023 04:31:38 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id C230110CCA0; Wed, 15 Mar 2023 14:31:35 +0300 (+03) From: "Kirill A. Shutemov" To: Andrew Morton , Mel Gorman , Vlastimil Babka , David Hildenbrand Cc: linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin Subject: [PATCH 04/10] drm/i915: Fix MAX_ORDER usage in i915_gem_object_get_pages_internal() Date: Wed, 15 Mar 2023 14:31:27 +0300 Message-Id: <20230315113133.11326-5-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> References: <20230315113133.11326-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: C335418002C X-Rspamd-Server: rspam01 X-Stat-Signature: 5mc87g8k7xohzqab6enhthui5dts745u X-HE-Tag: 1678879905-310351 X-HE-Meta: U2FsdGVkX19QKtGj56svZ92i2LNdRyxGsUK7N/QE37YjJpYz/yVypSntltjDOr+fNP/rPjRktfj9TmHusYBB0kQ4o0dXX/2JULYVwe569lm4xGLCRYpiLKd1eaHpmqpBKC4psQNdI2bCuiawK6LGK0wPM++fQXWqYz0+IV2q2ImsyA6u8Wi+wOrT+3EcAS5riqictAEvEMl1yGJlj0UCVY44BA0qu+2D6rDZjw65gAoTuWHgKd8cwJP7IHTawmS9WKtDuZnIWa+gS32ETz8GrkITU5unkoBjL101dBeLG5bC4j2+smtQnN5q1yIiZ8JS95qSyDXYNDr679jiCao7gOWWnKo0NXyoaQ3u5dI2D6AFQSBImLqPP5iZeZzV+jVAFXfBrtB6weAhEhpDWXZUDrbnfdaQNc4Xn9rEqORYzBTYFwZTGxAIrZoxn9tmE387HmTKtkUmtTyBRnvyOmJB25TNYsy3Cvu07mkNdDq6ehD+lt2+JuZNED3Ho2RFMRnt1YlTqUOHWzlQHDbUVAoZJR2z+lqkkIJI7szxB8VXxJR6piaqqXxLXnk75sTa/sTVYk7N8RmE/pFQwEZH4IK0CYQPJ1Dw++pQD0HVxQQC79QirIjmdMLVw93INImiag1yh5ZKhupUPMgKYXhlODQY2QL12RQBWU1Few9YuQI10XjslnJ6ME3/S/BUmBUaGTdGRMxQQHKvL3sIrd2EgxhgrgsKwY/qcmKytAyal25z0ktear+GBdB7gXi1iINi4je0BXbmCTwoblIGfxakr1vU6sd3TMC3Bhwo26SNsju68vTNW2KuIpzFMdDBbQ2K6zNem0hvJKnvlNQ3fME6cJtjsZsJj6xQzAAGz/ixTrB99i4bks8Lme048O/bVphxkUfN607xfeIsg7vlwYJSRO3kY+vN/o9Jl/yhxrEyw98/cTgcX7eag3D/QtPcUZ3M1pRg7aHYQVflV9g10aZ+B1y 0WqTzd6F 2d3Rqe3YaovWdtp3XvffzgUyT2flEtAuq+rHXA6VGZ8bvnCYe9qEM5XAWV9nsTblqfeVieZj2BzdLEMt8CEDyHnGD2vfVW+jEdMFzZcOT/ATH10C/lgZRXu/QvrhTAYKH1D1S1c6L6TVRDU7cZ/e/x25OY2C7z3vhRDSZQQpUSgp6Tu/Sww0/6Xx1prcXHJ9qt+GWEIqHN4zUsUr9EPYm5wR6mzlOOvT0/wFEE6PrSZR3cYkT0TS5Ez/Fqg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in i915_gem_object_get_pages_internal(). Signed-off-by: Kirill A. Shutemov Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: Tvrtko Ursulin Acked-by: Tvrtko Ursulin Acked-by: Vlastimil Babka --- drivers/gpu/drm/i915/gem/i915_gem_internal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_internal.c b/drivers/gpu/drm/i915/gem/i915_gem_internal.c index 6bc26b4b06b8..eae9e9f6d3bf 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_internal.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_internal.c @@ -36,7 +36,7 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj) struct sg_table *st; struct scatterlist *sg; unsigned int npages; /* restricted by sg_alloc_table */ - int max_order = MAX_ORDER; + int max_order = MAX_ORDER - 1; unsigned int max_segment; gfp_t gfp;