staging: rtl8723au: Fix endian abnormality in mlme_evt_hdl23a()
authorJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 9 May 2014 13:03:18 +0000 (15:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 20:11:56 +0000 (13:11 -0700)
Every other place uses C2HEvent_Header() for events. Given the struct
is endian dependant, use it here too to retrieve data from the parm
buffer.

Note the length field is not set/read in le order - question is
whether it's simply an opaque field?

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_mlme_ext.c

index 8b39087d158d039c2862d3f686d95661eeefb014..0372820538fda0ad908aa7809f8643d400e7f00f 100644 (file)
@@ -6416,13 +6416,13 @@ u8 mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
 {
        u8 evt_code, evt_seq;
        u16 evt_sz;
-       const uint *peventbuf;
+       const struct C2HEvent_Header *c2h;
        void (*event_callback)(struct rtw_adapter *dev, u8 *pbuf);
 
-       peventbuf = (uint*)pbuf;
-       evt_sz = (u16)(*peventbuf&0xffff);
-       evt_seq = (u8)((*peventbuf>>24)&0x7f);
-       evt_code = (u8)((*peventbuf>>16)&0xff);
+       c2h = (struct C2HEvent_Header *)pbuf;
+       evt_sz = c2h->len;
+       evt_seq = c2h->seq;
+       evt_code = c2h->ID;
 
        /*  checking if event code is valid */
        if (evt_code >= MAX_C2HEVT) {
@@ -6438,12 +6438,8 @@ u8 mlme_evt_hdl23a(struct rtw_adapter *padapter, const u8 *pbuf)
                goto _abort_event_;
        }
 
-       peventbuf += 2;
-
-       if (peventbuf) {
-               event_callback = wlanevents[evt_code].event_callback;
-               event_callback(padapter, (u8*)peventbuf);
-       }
+       event_callback = wlanevents[evt_code].event_callback;
+       event_callback(padapter, (u8 *)pbuf + sizeof(struct C2HEvent_Header));
 
 _abort_event_: