Re: [PATCH 2/2] PCI: Fix NULL pointer access in pci_store_saved_state()

From: Lukas Wunner

Date: Wed Apr 08 2026 - 07:00:21 EST


On Wed, Apr 08, 2026 at 03:16:28PM +0530, Krishna Chaitanya Chundru wrote:
> On 4/5/2026 1:32 PM, Lukas Wunner wrote:
> > On Sat, Apr 04, 2026 at 02:23:00PM +0530, Krishna Chaitanya Chundru wrote:
> > No, please validate values read from config space with
> > PCI_POSSIBLE_ERROR() before using them to access memory at
> > a location that may be out-of-bounds. Or cache the size on
> > enumeration and avoid re-reading it upon pci_save_state().
>
> pci_save_state() has many config reading having check for each read
> is not ideal way

The ask is not to guard every config space read with a check,
but only ones which are used to calculate the offset into a
memory allocation. We only need to prevent out-of-bounds
memory accesses. We do not need to prevent saving "all ones".

Thanks,

Lukas