Youness Alaoui uploaded patch set #3 to this change.

View Change

rpci: Use pci_dev struct pointer to avoid API breaks

The pci_dev structure is never meant to be used as is, but always as a
pointer. By using the struct itself in undo_pci_write_data, we are risking
data corruption, or buffer overflows if the structure size changes.

This is especially apparent on my system where flashrom segfaults
because I compile it with pciutils 3.3.0 and I run it on a system
with pciutils 3.5.2. The struture size is different and causes a
struct with the wrong size to be sent to the library, with invalid
internal field values.

This has been discovered and discussed in Change ID 18925 [1]


Change-Id: Icde2e587992ba964d4ff92c33aa659850ba06298
Signed-off-by: Youness Alaoui <>
M pcidev.c
M programmer.h
2 files changed, 20 insertions(+), 9 deletions(-)

git pull ssh:// refs/changes/84/20784/3

To view, visit change 20784. To unsubscribe, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: staging
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icde2e587992ba964d4ff92c33aa659850ba06298
Gerrit-Change-Number: 20784
Gerrit-PatchSet: 3
Gerrit-Owner: Youness Alaoui <>
Gerrit-Reviewer: David Hendricks <>
Gerrit-Reviewer: Nico Huber <>
Gerrit-Reviewer: Paul Menzel <>
Gerrit-Reviewer: Youness Alaoui <>
Gerrit-Reviewer: build bot (Jenkins) <>