Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c8c2513 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller
Browse files

sfc: make function tables const



The phy, mac, and board information structures should be const.
Since tables contain function pointer this improves security
(at least theoretically).

Compile tested only.

Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 44f4d5a2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2245,7 +2245,7 @@ static bool efx_port_dummy_op_poll(struct efx_nic *efx)
	return false;
}

static struct efx_phy_operations efx_dummy_phy_operations = {
static const struct efx_phy_operations efx_dummy_phy_operations = {
	.init		 = efx_port_dummy_op_int,
	.reconfigure	 = efx_port_dummy_op_int,
	.poll		 = efx_port_dummy_op_poll,
@@ -2261,7 +2261,7 @@ static struct efx_phy_operations efx_dummy_phy_operations = {
/* This zeroes out and then fills in the invariants in a struct
 * efx_nic (including all sub-structures).
 */
static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type,
static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type,
			   struct pci_dev *pci_dev, struct net_device *net_dev)
{
	int i;
@@ -2451,7 +2451,7 @@ static int efx_pci_probe_main(struct efx_nic *efx)
static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
				   const struct pci_device_id *entry)
{
	struct efx_nic_type *type = (struct efx_nic_type *) entry->driver_data;
	const struct efx_nic_type *type = (const struct efx_nic_type *) entry->driver_data;
	struct net_device *net_dev;
	struct efx_nic *efx;
	int i, rc;
+2 −2
Original line number Diff line number Diff line
@@ -1703,7 +1703,7 @@ static int falcon_set_wol(struct efx_nic *efx, u32 type)
 **************************************************************************
 */

struct efx_nic_type falcon_a1_nic_type = {
const struct efx_nic_type falcon_a1_nic_type = {
	.probe = falcon_probe_nic,
	.remove = falcon_remove_nic,
	.init = falcon_init_nic,
@@ -1744,7 +1744,7 @@ struct efx_nic_type falcon_a1_nic_type = {
	.reset_world_flags = ETH_RESET_IRQ,
};

struct efx_nic_type falcon_b0_nic_type = {
const struct efx_nic_type falcon_b0_nic_type = {
	.probe = falcon_probe_nic,
	.remove = falcon_remove_nic,
	.init = falcon_init_nic,
+1 −1
Original line number Diff line number Diff line
@@ -362,7 +362,7 @@ void falcon_poll_xmac(struct efx_nic *efx)
	falcon_ack_status_intr(efx);
}

struct efx_mac_operations falcon_xmac_operations = {
const struct efx_mac_operations falcon_xmac_operations = {
	.reconfigure	= falcon_reconfigure_xmac,
	.update_stats	= falcon_update_stats_xmac,
	.check_fault	= falcon_xmac_check_fault,
+2 −2
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@

#include "net_driver.h"

extern struct efx_mac_operations falcon_xmac_operations;
extern struct efx_mac_operations efx_mcdi_mac_operations;
extern const struct efx_mac_operations falcon_xmac_operations;
extern const struct efx_mac_operations efx_mcdi_mac_operations;
extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr,
			      u32 dma_len, int enable, int clear);

+1 −1
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ static bool efx_mcdi_mac_check_fault(struct efx_nic *efx)
}


struct efx_mac_operations efx_mcdi_mac_operations = {
const struct efx_mac_operations efx_mcdi_mac_operations = {
	.reconfigure	= efx_mcdi_mac_reconfigure,
	.update_stats	= efx_port_dummy_op_void,
	.check_fault 	= efx_mcdi_mac_check_fault,
Loading