Skip to content

Commit 8636229

Browse files
larsclausenkwilczynski
authored andcommitted
PCI: endpoint: Make struct pci_epf_ops in pci_epf_driver const
The pci_epf_ops struct contains a set of callbacks that are used by the pci_epf_driver, and is never modified by the EPF core itself. Marking the struct pointer const allows EPF drivers to declare their pci_epf_ops struct to be const. This allows the struct to be placed in the read-only section. Which for example brings some security benefits as the callbacks can not be overwritten. [kwilczynski: commit log] Link: https://lore.kernel.org/linux-pci/20230722230848.589428-1-lars@metafoo.de Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
1 parent b85ea95 commit 8636229

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/pci-epf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ struct pci_epf_driver {
9898
void (*remove)(struct pci_epf *epf);
9999

100100
struct device_driver driver;
101-
struct pci_epf_ops *ops;
101+
const struct pci_epf_ops *ops;
102102
struct module *owner;
103103
struct list_head epf_group;
104104
const struct pci_epf_device_id *id_table;

0 commit comments

Comments
 (0)