Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c7bc376 authored by Rashika Kheria's avatar Rashika Kheria Committed by Greg Kroah-Hartman
Browse files

Staging: et131x: Fix Smatch Warning of Buffer Overflow



This patch fixes the following Sparse Warning in et131x.c-

drivers/staging/et131x/et131x.c:2957 nic_send_packet() error: buffer overflow 'frags' 17 <= 21
drivers/staging/et131x/et131x.c:2959 nic_send_packet() warn: buffer overflow 'frags' 17 <= 21
drivers/staging/et131x/et131x.c:2961 nic_send_packet() error: buffer overflow 'frags' 17 <= 21

Signed-off-by: default avatarRashika Kheria <rashika.kheria@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 800df1a5
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -2902,8 +2902,9 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb)
	 * number of fragments. If needed, we can call this function,
	 * number of fragments. If needed, we can call this function,
	 * although it is less efficient.
	 * although it is less efficient.
	 */
	 */
	if (nr_frags > 23)

		return -EIO;
	/* nr_frags should be no more than 18. */
	BUILD_BUG_ON(MAX_SKB_FRAGS + 1 > 23);


	memset(desc, 0, sizeof(struct tx_desc) * (nr_frags + 1));
	memset(desc, 0, sizeof(struct tx_desc) * (nr_frags + 1));