staging: rtl8821ae: Pass large struct by const reference
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Tue, 1 Jul 2014 10:25:44 +0000 (12:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Jul 2014 23:51:48 +0000 (16:51 -0700)
struct rtl_stats is rather huge (152 bytes), and since
rtl8812ae_rx_command_packet_handler() does not modify it, it might as
well be passed by const reference.

Reported by Coverity: CID 1167285

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8821ae/pci.c
drivers/staging/rtl8821ae/rtl8821ae/sw.c
drivers/staging/rtl8821ae/wifi.h

index e194ffe58acc99b6b45690153ff5267aea479f31..f9847d1fbdebae821e8aaab5f32ae0109bc7dfe5 100644 (file)
@@ -861,7 +861,7 @@ static void _rtl_pci_rx_interrupt(struct ieee80211_hw *hw)
                        break;
                }
 
-               rtlpriv->cfg->ops->rx_command_packet_handler(hw, status, skb);
+               rtlpriv->cfg->ops->rx_command_packet_handler(hw, &status, skb);
 
                /*
                 *NOTICE This can not be use for mac80211,
index 26212755f88e9869cd9d1031229bd25883633b14..115002f98e2d816f537ef9d59a1e5fcf9e5781cd 100644 (file)
@@ -227,14 +227,14 @@ void rtl8821ae_deinit_sw_vars(struct ieee80211_hw *hw)
 
 static u32 rtl8812ae_rx_command_packet_handler(
        struct ieee80211_hw *hw,
-       struct rtl_stats status,
+       const struct rtl_stats *status,
        struct sk_buff *skb
        )
 {
        u32 result = 0;
        struct rtl_priv *rtlpriv = rtl_priv(hw);
 
-       switch (status.packet_report_type) {
+       switch (status->packet_report_type) {
                case NORMAL_RX:
                        result = 0;
                        break;
index e8250dad613bd75668983798082a7438e11f7d71..218cd44fbc6465af76b5762c452fbee5f09c04d0 100644 (file)
@@ -1853,7 +1853,7 @@ struct rtl_hal_ops {
                             u32 cmd_len, u8 *p_cmdbuffer);
        bool (*get_btc_status)(void);
        u32 (*rx_command_packet_handler)(struct ieee80211_hw *hw,
-                                        struct rtl_stats status,
+                                        const struct rtl_stats *status,
                                         struct sk_buff *skb);
 };