Mainak Sen 3b36d6b76f gpu: host1x: Fix NULL pointer dereference in job allocation
Fix NULL pointer dereference when num_unpins is 0,
which causes job->addr_phys to be NULL. In this
case, the code was incorrectly trying to set
job->gather_addr_phys to &job->addr_phys[num_relocs],
which would dereference a NULL pointer.

Add proper NULL checks to prevent this issue
both during allocation and when
using job->gather_addr_phys throughout the code.

Fixes CID 12627383:
- CERT-C Expression (CERT EXP34-C)
Fixes CID 12627953:
- Explicit null dereferenced (FORWARD_NULL)

Jira HOSTX-5971

Change-Id: If417ec5b5431a4f4b716ca73ddf279c9b0336c94
Signed-off-by: Mainak Sen <msen@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3324441
Reviewed-by: Raghavendra Vishnu Kumar <rvk@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Vamsee Vardhan Thummala <vthummala@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2025-07-24 10:19:17 +00:00
2022-12-07 23:57:14 -08:00
2025-07-24 10:19:10 +00:00
2024-02-24 05:24:07 -08:00
Description
No description provided
34 MiB