Skip to content

Commit

Permalink
ixgbevf: make operations tables const
Browse files Browse the repository at this point in the history
The arrays of function pointers should be const to make life harder
for rootkits.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Jan 19, 2012
1 parent b5417bf commit 3d8fe98
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,12 @@ enum ixgbevf_boards {
board_X540_vf,
};

extern struct ixgbevf_info ixgbevf_82599_vf_info;
extern struct ixgbevf_info ixgbevf_X540_vf_info;
extern const struct ixgbevf_info ixgbevf_82599_vf_info;
extern const struct ixgbevf_info ixgbevf_X540_vf_info;
extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;

/* needed by ethtool.c */
extern char ixgbevf_driver_name[];
extern const char ixgbevf_driver_name[];
extern const char ixgbevf_driver_version[];

extern int ixgbevf_up(struct ixgbevf_adapter *adapter);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

#include "ixgbevf.h"

char ixgbevf_driver_name[] = "ixgbevf";
const char ixgbevf_driver_name[] = "ixgbevf";
static const char ixgbevf_driver_string[] =
"Intel(R) 10 Gigabit PCI Express Virtual Function Network Driver";

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/intel/ixgbevf/vf.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static s32 ixgbevf_check_mac_link_vf(struct ixgbe_hw *hw,
return 0;
}

static struct ixgbe_mac_operations ixgbevf_mac_ops = {
static const struct ixgbe_mac_operations ixgbevf_mac_ops = {
.init_hw = ixgbevf_init_hw_vf,
.reset_hw = ixgbevf_reset_hw_vf,
.start_hw = ixgbevf_start_hw_vf,
Expand All @@ -416,12 +416,12 @@ static struct ixgbe_mac_operations ixgbevf_mac_ops = {
.set_vfta = ixgbevf_set_vfta_vf,
};

struct ixgbevf_info ixgbevf_82599_vf_info = {
const struct ixgbevf_info ixgbevf_82599_vf_info = {
.mac = ixgbe_mac_82599_vf,
.mac_ops = &ixgbevf_mac_ops,
};

struct ixgbevf_info ixgbevf_X540_vf_info = {
const struct ixgbevf_info ixgbevf_X540_vf_info = {
.mac = ixgbe_mac_X540_vf,
.mac_ops = &ixgbevf_mac_ops,
};
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ixgbevf/vf.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ struct ixgbevf_hw_stats {

struct ixgbevf_info {
enum ixgbe_mac_type mac;
struct ixgbe_mac_operations *mac_ops;
const struct ixgbe_mac_operations *mac_ops;
};

#endif /* __IXGBE_VF_H__ */
Expand Down

0 comments on commit 3d8fe98

Please sign in to comment.