Merge tag 'lsk-v4.4-17.03-android' of git://git.linaro.org/kernel/linux-linaro-stable.git
[firefly-linux-kernel-4.4.55.git] / drivers / staging / rtl8712 / rtl871x_recv.c
index 4ff53015518703159ab42fa5799c2a09048a1928..04ac23cc47a84b8c16ce35276015f7f333d14a7d 100644 (file)
@@ -641,11 +641,16 @@ sint r8712_wlanhdr_to_ethhdr(union recv_frame *precvframe)
                /* append rx status for mp test packets */
                ptr = recvframe_pull(precvframe, (rmv_len -
                      sizeof(struct ethhdr) + 2) - 24);
+               if (!ptr)
+                       return _FAIL;
                memcpy(ptr, get_rxmem(precvframe), 24);
                ptr += 24;
-       } else
+       } else {
                ptr = recvframe_pull(precvframe, (rmv_len -
                      sizeof(struct ethhdr) + (bsnaphdr ? 2 : 0)));
+               if (!ptr)
+                       return _FAIL;
+       }
 
        memcpy(ptr, pattrib->dst, ETH_ALEN);
        memcpy(ptr + ETH_ALEN, pattrib->src, ETH_ALEN);