summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-12-25 10:06:22 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-12-25 10:06:22 +0000
commitcd2416e6ea0660bd93b051fa14aadfb3ad5f5f64 (patch)
treef0380fa367598823e2b0a693bd49d15484094301 /target
parent0a24ec2e4aa4601e4ce29071ccce2d1f0cb39012 (diff)
downloadmtk-20170518-cd2416e6ea0660bd93b051fa14aadfb3ad5f5f64.zip
mtk-20170518-cd2416e6ea0660bd93b051fa14aadfb3ad5f5f64.tar.gz
mtk-20170518-cd2416e6ea0660bd93b051fa14aadfb3ad5f5f64.tar.bz2
ledtrig-netdev: use dev_get_stats to get statistics on kernels >=2.6.30
Fixes a possible NULL pointer dereference. SVN-Revision: 18925
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic-2.6/files-2.6.30/drivers/leds/ledtrig-netdev.c11
-rw-r--r--target/linux/generic-2.6/files-2.6.31/drivers/leds/ledtrig-netdev.c11
-rw-r--r--target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c11
3 files changed, 12 insertions, 21 deletions
diff --git a/target/linux/generic-2.6/files-2.6.30/drivers/leds/ledtrig-netdev.c b/target/linux/generic-2.6/files-2.6.30/drivers/leds/ledtrig-netdev.c
index 4193e4e..8dba8e6 100644
--- a/target/linux/generic-2.6/files-2.6.30/drivers/leds/ledtrig-netdev.c
+++ b/target/linux/generic-2.6/files-2.6.30/drivers/leds/ledtrig-netdev.c
@@ -46,7 +46,7 @@
* link: LED's normal state reflects whether the link is up (has carrier) or not
* tx: LED blinks on transmitted data
* rx: LED blinks on receive data
- *
+ *
* Some suggestions:
*
* Simple link status LED:
@@ -307,7 +307,7 @@ done:
static void netdev_trig_timer(unsigned long arg)
{
struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
- struct net_device_stats *dev_stats;
+ const struct net_device_stats *dev_stats;
unsigned new_activity;
write_lock(&trigger_data->lock);
@@ -317,11 +317,8 @@ static void netdev_trig_timer(unsigned long arg)
led_set_brightness(trigger_data->led_cdev, ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) ? LED_FULL : LED_OFF);
goto no_restart;
}
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
- dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev);
-#else
- dev_stats = trigger_data->net_dev->netdev_ops->ndo_get_stats(trigger_data->net_dev);
-#endif
+
+ dev_stats = dev_get_stats(trigger_data->net_dev);
new_activity =
((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);
diff --git a/target/linux/generic-2.6/files-2.6.31/drivers/leds/ledtrig-netdev.c b/target/linux/generic-2.6/files-2.6.31/drivers/leds/ledtrig-netdev.c
index 4193e4e..8dba8e6 100644
--- a/target/linux/generic-2.6/files-2.6.31/drivers/leds/ledtrig-netdev.c
+++ b/target/linux/generic-2.6/files-2.6.31/drivers/leds/ledtrig-netdev.c
@@ -46,7 +46,7 @@
* link: LED's normal state reflects whether the link is up (has carrier) or not
* tx: LED blinks on transmitted data
* rx: LED blinks on receive data
- *
+ *
* Some suggestions:
*
* Simple link status LED:
@@ -307,7 +307,7 @@ done:
static void netdev_trig_timer(unsigned long arg)
{
struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
- struct net_device_stats *dev_stats;
+ const struct net_device_stats *dev_stats;
unsigned new_activity;
write_lock(&trigger_data->lock);
@@ -317,11 +317,8 @@ static void netdev_trig_timer(unsigned long arg)
led_set_brightness(trigger_data->led_cdev, ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) ? LED_FULL : LED_OFF);
goto no_restart;
}
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
- dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev);
-#else
- dev_stats = trigger_data->net_dev->netdev_ops->ndo_get_stats(trigger_data->net_dev);
-#endif
+
+ dev_stats = dev_get_stats(trigger_data->net_dev);
new_activity =
((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);
diff --git a/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c b/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c
index 4193e4e..8dba8e6 100644
--- a/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c
+++ b/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c
@@ -46,7 +46,7 @@
* link: LED's normal state reflects whether the link is up (has carrier) or not
* tx: LED blinks on transmitted data
* rx: LED blinks on receive data
- *
+ *
* Some suggestions:
*
* Simple link status LED:
@@ -307,7 +307,7 @@ done:
static void netdev_trig_timer(unsigned long arg)
{
struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg;
- struct net_device_stats *dev_stats;
+ const struct net_device_stats *dev_stats;
unsigned new_activity;
write_lock(&trigger_data->lock);
@@ -317,11 +317,8 @@ static void netdev_trig_timer(unsigned long arg)
led_set_brightness(trigger_data->led_cdev, ((trigger_data->mode & MODE_LINK) != 0 && trigger_data->link_up) ? LED_FULL : LED_OFF);
goto no_restart;
}
-#ifdef CONFIG_COMPAT_NET_DEV_OPS
- dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev);
-#else
- dev_stats = trigger_data->net_dev->netdev_ops->ndo_get_stats(trigger_data->net_dev);
-#endif
+
+ dev_stats = dev_get_stats(trigger_data->net_dev);
new_activity =
((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) +
((trigger_data->mode & MODE_RX) ? dev_stats->rx_packets : 0);