Re: [PATCH v6 6/7] drm/xe/vf: Add bounds checking for queried VRAM size
Michal Wajdeczko <[email protected]>
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
On 8/12/2026 2:43 PM, Satyanarayana K V P wrote: > Add explicit bounds checks for VRAM size which can detect and reject > invalid configuration data from a misconfigured or malfunctioning PF, > preventing protocol violations and protecting VF initialization. > > Signed-off-by: Satyanarayana K V P <[email protected]> > Cc: Michal Wajdeczko <[email protected]> as Sashiko pointed out, update commit subject/message with that fixed, Reviewed-by: Michal Wajdeczko <[email protected]> > --- > V5 -> V6: > - Return -EINVAL for unaligned LMEM size (Michal W). > > V4 -> V5: > - New commit. > --- > drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c > index d805c064377c..be932ebe6a8d 100644 > --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c > +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c > @@ -574,6 +574,12 @@ static int vf_get_lmem_info(struct xe_gt *gt) > return -EREMCHG; > } > > + if (!IS_ALIGNED(size, SZ_2M)) { > + xe_gt_sriov_err(gt, "Unaligned LMEM size %llu, expected %llu\n", > + size, ALIGN(size, SZ_2M)); > + return -EINVAL; > + } > + > string_get_size(size, 1, STRING_UNITS_2, size_str, sizeof(size_str)); > xe_gt_sriov_dbg_verbose(gt, "LMEM %lluM %s\n", size / SZ_1M, size_str); >