From f6cad121fd6af20bbc970049d96e7bfdc85bbc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 23 Feb 2021 10:44:36 -0500 Subject: [PATCH] nouveau_vieux: use align_calloc for the context to fix m32 crashes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes: 3175b63a0dfa290 "mesa: don't allocate matrices with malloc" Reviewed-by: Eric Anholt Reviewed-by: Zoltán Böszörményi Part-of: (cherry picked from commit f827b29234cb3dfa4ff07adbcf1550fd53e0a573) --- .pick_status.json | 2 +- src/mesa/drivers/dri/nouveau/nv04_context.c | 4 ++-- src/mesa/drivers/dri/nouveau/nv10_context.c | 4 ++-- src/mesa/drivers/dri/nouveau/nv20_context.c | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f364e14d9fb..35e2d96e9b6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -760,7 +760,7 @@ "description": "nouveau_vieux: use align_calloc for the context to fix m32 crashes", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "3175b63a0dfa290430f9f7eb651387788933a02b" }, diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c index d64fcc3ccd7..6c291a35087 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_context.c +++ b/src/mesa/drivers/dri/nouveau/nv04_context.c @@ -134,7 +134,7 @@ nv04_context_destroy(struct gl_context *ctx) nouveau_object_del(&nctx->hw.surf3d); nouveau_context_deinit(ctx); - free(ctx); + align_free(ctx); } static struct gl_context * @@ -147,7 +147,7 @@ nv04_context_create(struct nouveau_screen *screen, gl_api api, struct gl_context *ctx; int ret; - nctx = CALLOC_STRUCT(nv04_context); + nctx = align_calloc(sizeof(struct nv04_context), 16); if (!nctx) return NULL; diff --git a/src/mesa/drivers/dri/nouveau/nv10_context.c b/src/mesa/drivers/dri/nouveau/nv10_context.c index 93a490b5986..3d0d489ee5f 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_context.c +++ b/src/mesa/drivers/dri/nouveau/nv10_context.c @@ -424,7 +424,7 @@ nv10_context_destroy(struct gl_context *ctx) nouveau_object_del(&nctx->hw.eng3d); nouveau_context_deinit(ctx); - free(ctx); + align_free(ctx); } static struct gl_context * @@ -437,7 +437,7 @@ nv10_context_create(struct nouveau_screen *screen, gl_api api, unsigned celsius_class; int ret; - nctx = CALLOC_STRUCT(nouveau_context); + nctx = align_calloc(sizeof(struct nouveau_context), 16); if (!nctx) return NULL; diff --git a/src/mesa/drivers/dri/nouveau/nv20_context.c b/src/mesa/drivers/dri/nouveau/nv20_context.c index 01fece4466a..387bb069468 100644 --- a/src/mesa/drivers/dri/nouveau/nv20_context.c +++ b/src/mesa/drivers/dri/nouveau/nv20_context.c @@ -435,7 +435,7 @@ nv20_context_destroy(struct gl_context *ctx) nouveau_object_del(&nctx->hw.eng3d); nouveau_context_deinit(ctx); - free(ctx); + align_free(ctx); } static struct gl_context * @@ -448,7 +448,7 @@ nv20_context_create(struct nouveau_screen *screen, gl_api api, unsigned kelvin_class; int ret; - nctx = CALLOC_STRUCT(nouveau_context); + nctx = align_calloc(sizeof(struct nouveau_context), 16); if (!nctx) return NULL;