On Wed, 2026-08-26 at 23:01 +0000, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider:
> - [Medium] The variable `err` is used uninitialized in the warning
> message when `pci_enable_wake()` fails, potentially leaking stack
> memory to the kernel log.
> --
> 
> commit 49538b2bae6d5a5f0599da227733b24b63d3639b
> Author: Vinod Govindapillai <[email protected]>
> 
>     drm/xe/pm: allow the device to signal PME from D3hot
>     
>     Make the device a usable wakeup source so it can raise PME while
> runtime
>     suspended to D3hot The PCI core marks endpoints wakeup-capable
> but leaves
>     them disabled, so pci_enable_wake() returns -EINVAL until the
> driver opts
>     in using devm_device_init_wakeup(). D3cold is excluded, as the
> device
>     loses power there and cannot signal at all.
> 
> > diff --git a/drivers/gpu/drm/xe/xe_pci.c
> > b/drivers/gpu/drm/xe/xe_pci.c
> > index 3b3b6426d960c..af59859fd8c96 100644
> > --- a/drivers/gpu/drm/xe/xe_pci.c
> > +++ b/drivers/gpu/drm/xe/xe_pci.c
> [ ... ]
> > @@ -1380,6 +1384,7 @@ static int xe_pci_runtime_suspend(struct
> > device *dev)
> >  {
> >     struct pci_dev *pdev = to_pci_dev(dev);
> >     struct xe_device *xe = pdev_to_xe_device(pdev);
> > +   bool pme_armed = false;
> >     int err;
> >  
> >     /*
> > @@ -1391,9 +1396,20 @@ static int xe_pci_runtime_suspend(struct
> > device *dev)
> >     xe_assert(xe, !IS_SRIOV_VF(xe));
> >     xe_assert(xe, !pci_num_vf(pdev));
> >  
> > -   err = xe_pm_runtime_suspend(xe, false);
> > -   if (err)
> > +   if (xe_pm_pme_capable(xe)) {
> > +           pme_armed = !pci_enable_wake(pdev, PCI_D3hot,
> > true);
> > +           if (!pme_armed)
> > +                   drm_warn(&xe->drm,
> > +                            "Failed to arm PME for D3hot:
> > %d\n", err);
> 
> [Severity: Medium]
> Could this leak uninitialized stack memory to the kernel log? It
> looks like
> the variable err is used in the warning message when
> pci_enable_wake() fails
> in xe_pci_runtime_suspend(), but it hasn't been initialized yet.
> Since the
> return value from pci_enable_wake() is inverted into the boolean
> pme_armed,
> the actual error code is never captured in err before printing it.
> 
Yes. This need to fixed. Will fix this in the next iteration

BR
Vinod

Reply via email to