Changeset 18925


Ignore:
Timestamp:
2009-12-25T11:06:22+01:00 (7 years ago)
Author:
juhosg
Message:

ledtrig-netdev: use dev_get_stats to get statistics on kernels >=2.6.30

Fixes a possible NULL pointer dereference.

Location:
trunk/target/linux/generic-2.6
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic-2.6/files-2.6.30/drivers/leds/ledtrig-netdev.c

    r16516 r18925  
    4747 *   tx:   LED blinks on transmitted data 
    4848 *   rx:   LED blinks on receive data 
    49  *  
     49 * 
    5050 * Some suggestions: 
    5151 * 
     
    308308{ 
    309309        struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    310         struct net_device_stats *dev_stats; 
     310        const struct net_device_stats *dev_stats; 
    311311        unsigned new_activity; 
    312312 
     
    318318                goto no_restart; 
    319319        } 
    320 #ifdef CONFIG_COMPAT_NET_DEV_OPS 
    321         dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev); 
    322 #else 
    323         dev_stats = trigger_data->net_dev->netdev_ops->ndo_get_stats(trigger_data->net_dev); 
    324 #endif 
     320 
     321        dev_stats = dev_get_stats(trigger_data->net_dev); 
    325322        new_activity = 
    326323                ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
  • trunk/target/linux/generic-2.6/files-2.6.31/drivers/leds/ledtrig-netdev.c

    r17356 r18925  
    4747 *   tx:   LED blinks on transmitted data 
    4848 *   rx:   LED blinks on receive data 
    49  *  
     49 * 
    5050 * Some suggestions: 
    5151 * 
     
    308308{ 
    309309        struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    310         struct net_device_stats *dev_stats; 
     310        const struct net_device_stats *dev_stats; 
    311311        unsigned new_activity; 
    312312 
     
    318318                goto no_restart; 
    319319        } 
    320 #ifdef CONFIG_COMPAT_NET_DEV_OPS 
    321         dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev); 
    322 #else 
    323         dev_stats = trigger_data->net_dev->netdev_ops->ndo_get_stats(trigger_data->net_dev); 
    324 #endif 
     320 
     321        dev_stats = dev_get_stats(trigger_data->net_dev); 
    325322        new_activity = 
    326323                ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
  • trunk/target/linux/generic-2.6/files-2.6.32/drivers/leds/ledtrig-netdev.c

    r17356 r18925  
    4747 *   tx:   LED blinks on transmitted data 
    4848 *   rx:   LED blinks on receive data 
    49  *  
     49 * 
    5050 * Some suggestions: 
    5151 * 
     
    308308{ 
    309309        struct led_netdev_data *trigger_data = (struct led_netdev_data *)arg; 
    310         struct net_device_stats *dev_stats; 
     310        const struct net_device_stats *dev_stats; 
    311311        unsigned new_activity; 
    312312 
     
    318318                goto no_restart; 
    319319        } 
    320 #ifdef CONFIG_COMPAT_NET_DEV_OPS 
    321         dev_stats = trigger_data->net_dev->get_stats(trigger_data->net_dev); 
    322 #else 
    323         dev_stats = trigger_data->net_dev->netdev_ops->ndo_get_stats(trigger_data->net_dev); 
    324 #endif 
     320 
     321        dev_stats = dev_get_stats(trigger_data->net_dev); 
    325322        new_activity = 
    326323                ((trigger_data->mode & MODE_TX) ? dev_stats->tx_packets : 0) + 
Note: See TracChangeset for help on using the changeset viewer.