Message ID | 5c0db456-2d8a-485f-875d-6408386fcaa5@moroto.mountain |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-17827-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp6183020dyb; Fri, 5 Jan 2024 04:21:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHarAEtX0Xx3DiGAuRSaESMdSaeb9V4L3WZLkQSiAvj1H3mquT5Z5m50buksgWm8Jec8E4V X-Received: by 2002:a05:6a20:e106:b0:196:5f70:b8bb with SMTP id kr6-20020a056a20e10600b001965f70b8bbmr2113465pzb.4.1704457270038; Fri, 05 Jan 2024 04:21:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704457270; cv=none; d=google.com; s=arc-20160816; b=FbJ1675CF0EXdVXL5oGGp3i3QNd55uKwh6a2iz5QMNVhrdiBi87uS7FqYf/WcwSxkf nVAxjAwKWydmQiZkWbU4spGqQV3NaLNyeWshG6K1zSuHl5wF2HPtznd3zXRQBqiVO4a1 JOiK7JHPaLEwR89mpNflUDapeatoPzeuVIVPQomgGmBOTmAnOaxxatqdFmnSXmDDXfK0 lAsWYXycq+zIn2cZRv3fHyWgJzAirCTZL9E/IUrXea9BSOtvnWrTe0AYC5cuWGceK+0p ftd0xynsJVh/F7JxLUd5EMa/D2gTsc6JGq0WMW3TFYkB59diCV52h2ivlqkFtSHu6+3s l2CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=VPgoGs4JCmFCXEz83XMMwyrfsqP4QMFdJVq1Hj+FDjY=; fh=tmNxfrcM0UrDtfPW3wvC2WLYTdVSmctan2jcuHdy8ao=; b=Z3YgbMNx+fmt3fwU5saexd/f1KIWu/MlheuiEoZnDgNFx7+y9eHMqFfwNICfMrRx4d N99pZqpboK9K83ieCelwdOXhydoYH4f0zB3nblD5OCequpyUa3G4LDPVgRDsN3W1LRre if3JUfbeC+gdJYkSCftM85gJbbz5h3kXuLt0n1fEaNopiJCnWsupkyA+i3prmOOsfQAa 47MpahS6Xsco3JjfywJjUi3n8ktP72Cjo7BiDhpsuUwaj99AYzaH51sWbffIe9TGXJWW eSBCLtCz/IpjzXbNQbGepGbuRjUTnVJh8xZ/bbMCv1J42+Mbpt1XFWvweBYM8GkcG+kP GOdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xneem7OM; spf=pass (google.com: domain of linux-kernel+bounces-17827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17827-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y13-20020a170902ed4d00b001d3ee9b8530si1148190plb.107.2024.01.05.04.21.09 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 04:21:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xneem7OM; spf=pass (google.com: domain of linux-kernel+bounces-17827-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17827-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C33C4B23016 for <ouuuleilei@gmail.com>; Fri, 5 Jan 2024 12:21:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA0EF2D622; Fri, 5 Jan 2024 12:20:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xneem7OM" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEA812D612 for <linux-kernel@vger.kernel.org>; Fri, 5 Jan 2024 12:20:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a275b3a1167so179652866b.3 for <linux-kernel@vger.kernel.org>; Fri, 05 Jan 2024 04:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704457239; x=1705062039; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=VPgoGs4JCmFCXEz83XMMwyrfsqP4QMFdJVq1Hj+FDjY=; b=xneem7OMkoDf3atnrKXSeY3V1gjCPnM7C6WMYvHrjIkLcJ/zxaBjSeiaFyGIrg7w78 RLry8F4sQXDfg/Tjso7fY43ILc0h/UYoqsCHascN37sU8kUDh2f/GeZ9Tk1BrKR0s4uf IYbwKdXMb7IzNtDc1mGnUZEUMtri/UheOyWuG7vUMIXmMFb4U9we1VmOt2M+y6Y7HmuU PTP+YjobJEpP85sZCr0Lgji76UAihWb5ntRa4MAZ8jqEIiBpBtWXghC0B8nlNbjiFJx9 zJoz942agkVdMpt0tvTeFQ+EuyT+WEbti1fdRM+kAtEsRL319TbG8678RJ7S7wOJ9njs VPTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704457239; x=1705062039; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VPgoGs4JCmFCXEz83XMMwyrfsqP4QMFdJVq1Hj+FDjY=; b=dGy3CwGjyNRTCqZF2RBBR+aGA6dT+7pzn2KNfeF1G4pw7xKE5T+XNo4ETwDvyliIYL gUC+RzcuNMQ/2dAQdK8EqaaGuVR+VxXYboqFNAGSQmLnU4CiObBQqecXzcV4qeCgOlqI ECA9Ax0xjyaIHpeWePv0eIKGiMdkPodWQJrXY+OtV6Ye8+jSRD8OtTJcaN1Igm5wqsuY 5q6a/wJMDEwCudGd4qP9N7cpo29cCzRLXXap80t4zwzKTj3NNcIpHGapWwzuMS3VtiVv qt59DynCuu4QYxAx2oANseGnyaYfNpkmAQe++gaNxV37Y6IPZ6xADLUPj6ArteSj87Cz Zrdg== X-Gm-Message-State: AOJu0YyFrwGp/5730ktoEnaQPNUdA75Ec6ZCaqyjjDvEVdoQXhC3MfPv ZHyff9VPWTSNEIgnBu1Rrah9vk8bwmUWeQ== X-Received: by 2002:a17:906:51c1:b0:a28:fa55:3597 with SMTP id v1-20020a17090651c100b00a28fa553597mr923237ejk.98.1704457239116; Fri, 05 Jan 2024 04:20:39 -0800 (PST) Received: from localhost ([102.140.209.237]) by smtp.gmail.com with ESMTPSA id r3-20020a170906704300b00a27e4d34455sm820240ejj.183.2024.01.05.04.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 04:20:38 -0800 (PST) Date: Fri, 5 Jan 2024 15:20:35 +0300 From: Dan Carpenter <dan.carpenter@linaro.org> To: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com>, Oded Gabbay <ogabbay@kernel.org>, Thomas =?iso-8859-1?q?Hellstr=F6m?= <thomas.hellstrom@linux.intel.com>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Rodrigo Vivi <rodrigo.vivi@intel.com>, Matthew Auld <matthew.auld@intel.com>, Nirmoy Das <nirmoy.das@intel.com>, Matt Roper <matthew.d.roper@intel.com>, Matthew Brost <matthew.brost@intel.com>, Pallavi Mishra <pallavi.mishra@intel.com>, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] drm/xe/selftests: Fix an error pointer dereference bug Message-ID: <5c0db456-2d8a-485f-875d-6408386fcaa5@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787252986510331258 X-GMAIL-MSGID: 1787252986510331258 |
Series |
drm/xe/selftests: Fix an error pointer dereference bug
|
|
Commit Message
Dan Carpenter
Jan. 5, 2024, 12:20 p.m. UTC
Check if "bo" is an error pointer before calling xe_bo_lock() on it.
Fixes: d6abc18d6693 ("drm/xe/xe2: Modify xe_bo_test for system memory")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/gpu/drm/xe/tests/xe_bo.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On Fri, Jan 05, 2024 at 03:20:35PM +0300, Dan Carpenter wrote: > Check if "bo" is an error pointer before calling xe_bo_lock() on it. > > Fixes: d6abc18d6693 ("drm/xe/xe2: Modify xe_bo_test for system memory") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Matthew Brost <matthew.brost@intel.com> > --- > drivers/gpu/drm/xe/tests/xe_bo.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c > index 412b2e7ce40c..3436fd9cf2b2 100644 > --- a/drivers/gpu/drm/xe/tests/xe_bo.c > +++ b/drivers/gpu/drm/xe/tests/xe_bo.c > @@ -125,14 +125,13 @@ static void ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile, > > bo = xe_bo_create_user(xe, NULL, NULL, SZ_1M, DRM_XE_GEM_CPU_CACHING_WC, > ttm_bo_type_device, bo_flags); > - > - xe_bo_lock(bo, false); > - > if (IS_ERR(bo)) { > KUNIT_FAIL(test, "Failed to create bo.\n"); > return; > } > > + xe_bo_lock(bo, false); > + > kunit_info(test, "Verifying that CCS data is cleared on creation.\n"); > ret = ccs_test_migrate(tile, bo, false, 0ULL, 0xdeadbeefdeadbeefULL, > test); > -- > 2.42.0 >
diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c index 412b2e7ce40c..3436fd9cf2b2 100644 --- a/drivers/gpu/drm/xe/tests/xe_bo.c +++ b/drivers/gpu/drm/xe/tests/xe_bo.c @@ -125,14 +125,13 @@ static void ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile, bo = xe_bo_create_user(xe, NULL, NULL, SZ_1M, DRM_XE_GEM_CPU_CACHING_WC, ttm_bo_type_device, bo_flags); - - xe_bo_lock(bo, false); - if (IS_ERR(bo)) { KUNIT_FAIL(test, "Failed to create bo.\n"); return; } + xe_bo_lock(bo, false); + kunit_info(test, "Verifying that CCS data is cleared on creation.\n"); ret = ccs_test_migrate(tile, bo, false, 0ULL, 0xdeadbeefdeadbeefULL, test);