Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Cc: "Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dan.carpenter@linaro.org,
	kernel-janitors@vger.kernel.org, error27@gmail.com
Subject: Re: [PATCH] drm/xe/svm: fix dereferencing error pointer in drm_gpusvm_range_alloc()
Date: Mon, 24 Mar 2025 09:57:50 -0700	[thread overview]
Message-ID: <Z+GPDvA8PM7DJ9ex@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20250323124907.3946370-1-harshit.m.mogalapalli@oracle.com>

On Sun, Mar 23, 2025 at 05:49:06AM -0700, Harshit Mogalapalli wrote:
> xe_svm_range_alloc() returns ERR_PTR(-ENOMEM) on failure and there is a
> dereference of "range" after that:
> 
> 	-->     range->gpusvm = gpusvm;
> 
> In xe_svm_range_alloc(), when memory allocation fails return NULL
> instead to handle this situation.
> 
> Fixes: 99624bdff867 ("drm/gpusvm: Add support for GPU Shared Virtual Memory")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/adaef4dd-5866-48ca-bc22-4a1ddef20381@stanley.mountain/
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
> This is based on static analysis and only compile tested.
> ---
>  drivers/gpu/drm/xe/xe_svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index 52e04e7e343f..a79df8cf1f36 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -80,7 +80,7 @@ xe_svm_range_alloc(struct drm_gpusvm *gpusvm)
>  
>  	range = kzalloc(sizeof(*range), GFP_KERNEL);
>  	if (!range)
> -		return ERR_PTR(-ENOMEM);
> +		return NULL;
>  
>  	INIT_LIST_HEAD(&range->garbage_collector_link);
>  	xe_vm_get(gpusvm_to_vm(gpusvm));
> -- 
> 2.39.3
> 

      parent reply	other threads:[~2025-03-24 16:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-23 12:49 [PATCH] drm/xe/svm: fix dereferencing error pointer in drm_gpusvm_range_alloc() Harshit Mogalapalli
2025-03-23 18:01 ` Christophe JAILLET
2025-03-24 13:29 ` ✓ CI.Patch_applied: success for " Patchwork
2025-03-24 13:29 ` ✓ CI.checkpatch: " Patchwork
2025-03-24 13:31 ` ✓ CI.KUnit: " Patchwork
2025-03-24 13:48 ` ✓ CI.Build: " Patchwork
2025-03-24 13:50 ` ✓ CI.Hooks: " Patchwork
2025-03-24 14:14 ` ✓ Xe.CI.BAT: " Patchwork
2025-03-24 16:02 ` ✗ Xe.CI.Full: failure " Patchwork
2025-03-24 16:57 ` Matthew Brost [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z+GPDvA8PM7DJ9ex@lstrano-desk.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=airlied@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=error27@gmail.com \
    --cc=harshit.m.mogalapalli@oracle.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=thomas.hellstrom@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox