author: Dan Carpenter <dan.carpenter@oracle.com> 2021-06-14 12:58:36 +0300
committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-07-14 17:07:40 +0200
commit: cf011614add0f71cd7ba3b1dcc0e753ac8f1ecb7
parent: b48eb064f4efbf457f8e3e0ee990fd83cc06b40e
Commit Summary:
Diffstat:
1 file changed, 6 insertions, 4 deletions
diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c
index a41af7aa74ec..bd5f87433404 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -611,10 +611,12 @@ static void gdm_lte_netif_rx(struct net_device *dev, char *buf,
* bytes (99,130,83,99 dec)
*/
} __packed;
- void *addr = buf + sizeof(struct iphdr) +
- sizeof(struct udphdr) +
- offsetof(struct dhcp_packet, chaddr);
- ether_addr_copy(nic->dest_mac_addr, addr);
+ int offset = sizeof(struct iphdr) +
+ sizeof(struct udphdr) +
+ offsetof(struct dhcp_packet, chaddr);
+ if (offset + ETH_ALEN > len)
+ return;
+ ether_addr_copy(nic->dest_mac_addr, buf + offset);
}
}