Skip to content

Commit 42bd415

Browse files
Dan Carpenterdakr
authored andcommitted
nouveau/gsp/r535: Fix a NULL vs error pointer bug
The r535_gsp_cmdq_get() function returns error pointers but this code checks for NULL. Also we need to propagate the error pointer back to the callers in r535_gsp_rpc_get(). Returning NULL will lead to a NULL pointer dereference. Fixes: 176fdcb ("drm/nouveau/gsp/r535: add support for booting GSP-RM") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Danilo Krummrich <[email protected]> Signed-off-by: Danilo Krummrich <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 09f12bf commit 42bd415

File tree

1 file changed

+2
-2
lines changed
  • drivers/gpu/drm/nouveau/nvkm/subdev/gsp

1 file changed

+2
-2
lines changed

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,8 @@ r535_gsp_rpc_get(struct nvkm_gsp *gsp, u32 fn, u32 argc)
689689
struct nvfw_gsp_rpc *rpc;
690690

691691
rpc = r535_gsp_cmdq_get(gsp, ALIGN(sizeof(*rpc) + argc, sizeof(u64)));
692-
if (!rpc)
693-
return NULL;
692+
if (IS_ERR(rpc))
693+
return ERR_CAST(rpc);
694694

695695
rpc->header_version = 0x03000000;
696696
rpc->signature = ('C' << 24) | ('P' << 16) | ('R' << 8) | 'V';

0 commit comments

Comments
 (0)