From f827b29234cb3dfa4ff07adbcf1550fd53e0a573 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: --- 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 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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;