Skip to content
Commit c60298c5 authored by sayli karnik's avatar sayli karnik Committed by Greg Kroah-Hartman
Browse files

staging: rtl8188eu: core: Replace memcpy() with ether_addr_copy() if ethernet...


staging: rtl8188eu: core: Replace memcpy() with ether_addr_copy() if ethernet addresses are __aligned(2)

This patch fixes the checkpatch warning:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are
__aligned(2)
Done using coccinelle:

@@
expression exp1, exp2;
@@
- memcpy(exp1, exp2, ETH_ALEN);
+ ether_addr_copy(exp1, exp2);

The output of pahole shows that the addresses are aligned:

struct ieee80211_hdr {
        __le16                     frame_control;        /*     0     2 */
        __le16                     duration_id;          /*     2     2 */
        u8                         addr1[6];             /*     4     6 */
        u8                         addr2[6];             /*    10     6 */
        u8                         addr3[6];             /*    16     6 */
        __le16                     seq_ctrl;             /*    22     2 */
        u8                         addr4[6];             /*    24     6 */

        /* size: 30, cachelines: 1, members: 7 */
        /* last cacheline: 30 bytes */
};

struct wlan_bssid_ex {
        u32                        Length;               /*     0     4 */
        unsigned char              MacAddress[6];        /*     4     6 */
        u8                         Reserved[2];          /*    10     2 */
        struct ndis_802_11_ssid    Ssid;                 /*    12    36 */
        u32                        Privacy;              /*    48     4 */
        long int                   Rssi;                 /*    52     8 */
        enum NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;  /*    60     4 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        struct ndis_802_11_config  Configuration;        /*    64    32 */
        enum ndis_802_11_network_infra InfrastructureMode; /*    96     4 */
        unsigned char              SupportedRates[16];   /*   100    16 */
        struct wlan_phy_info       PhyInfo;              /*   116     4 */
        u32                        IELength;             /*   120     4 */
        u8                         IEs[768];             /*   124   768 */
        /* --- cacheline 13 boundary (832 bytes) was 60 bytes ago --- */

        /* size: 892, cachelines: 14, members: 13 */
        /* last cacheline: 60 bytes */
};

struct stadel_event {
        unsigned char              macaddr[6];           /*     0     6 */
        unsigned char              rsvd[2];              /*     6     2 */
        int                        mac_id;               /*     8     4 */

        /* size: 12, cachelines: 1, members: 3 */
        /* last cacheline: 12 bytes */
};

Signed-off-by: default avatarsayli karnik <karniksayli1995@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fbafd397
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment