On 5/10/2024 8:20 AM, Jesse Zhang wrote: > Dividing expression num_xcc_per_xcp which may be zero has undefined behavior. > > Signed-off-by: Jesse Zhang <jesse.zh...@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c > b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c > index 414ea3f560a7..5752c6760992 100644 > --- a/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c > +++ b/drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c > @@ -522,6 +522,9 @@ static int aqua_vanjaram_switch_partition_mode(struct > amdgpu_xcp_mgr *xcp_mgr, > goto unlock; > > num_xcc_per_xcp = __aqua_vanjaram_get_xcc_per_xcp(xcp_mgr, mode); > + if (!num_xcc_per_xcp) > + goto unlock; > + This won't happen as the mode is validated before and for each valid mode a non-zero num_xcc_per_xcp is expected. To satisfy the warning-checker, before going to unlock use a proper 'ret' value also (otherwise it will look odd). Thanks, Lijo > if (adev->gfx.funcs->switch_partition_mode) > adev->gfx.funcs->switch_partition_mode(xcp_mgr->adev, > num_xcc_per_xcp);
- [PATCH 16/22] drm/amd/pm: fix enum type compared against... Jesse Zhang
- [PATCH 17/22] drm/amdgpu: fix the warning bad bit shift ... Jesse Zhang
- RE: [PATCH 17/22] drm/amdgpu: fix the warning bad b... Zhang, Jesse(Jie)
- RE: [PATCH 17/22] drm/amdgpu: fix the warning b... Wang, Yang(Kevin)
- [PATCH 18/22] drm/amd/pm: check negtive return for table... Jesse Zhang
- RE: [PATCH 18/22] drm/amd/pm: check negtive return ... Zhang, Jesse(Jie)
- [PATCH 19/22] drm/amdgpu: Fix the warning division or mo... Jesse Zhang
- RE: [PATCH 19/22] drm/amdgpu: Fix the warning divis... Huang, Tim
- Re: [PATCH 19/22] drm/amdgpu: Fix the warning divis... Lazar, Lijo
- RE: [PATCH 19/22] drm/amdgpu: Fix the warning d... Zhang, Jesse(Jie)
- Re: [PATCH 19/22] drm/amdgpu: Fix the warni... Lazar, Lijo
- [PATCH 20/22] drm/amd/pm: fix get dpm level count for sm... Jesse Zhang
- [PATCH 21/22] drm/amd/pm: fix get dpm level count for ye... Jesse Zhang
- [PATCH 22/22] drm/amdgpu: clear the warning unsigned com... Jesse Zhang
- RE: [PATCH 01/22] drm/amdgpu: fix dereference after null... Huang, Tim
- Re: [PATCH 01/22] drm/amdgpu: fix dereference after null... Christian König