[PATCH 1/5] PCI: endpoint: Make pci_epf_ops in pci_epf_driver const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The pci_epf_ops struct contains a set of callbacks that are used by the
pci_epf_driver. The ops struct is never modified by the epf core itself.

Marking the ops 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.

Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>
---
 include/linux/pci-epf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
index 3f44b6aec477..34be3f1da46c 100644
--- a/include/linux/pci-epf.h
+++ b/include/linux/pci-epf.h
@@ -98,7 +98,7 @@ struct pci_epf_driver {
 	void	(*remove)(struct pci_epf *epf);
 
 	struct device_driver	driver;
-	struct pci_epf_ops	*ops;
+	const struct pci_epf_ops *ops;
 	struct module		*owner;
 	struct list_head	epf_group;
 	const struct pci_epf_device_id	*id_table;
-- 
2.39.2




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux