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

Commit 4194b491 authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller
Browse files

packet: Don't check frames_per_block against negative values



rb->frames_per_block is an unsigned int, thus can never be negative.

Also fix spacing in the calculation of frames_per_block.

Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 321beec5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4122,7 +4122,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
			goto out;

		rb->frames_per_block = req->tp_block_size / req->tp_frame_size;
		if (unlikely(rb->frames_per_block <= 0))
		if (unlikely(rb->frames_per_block == 0))
			goto out;
		if (unlikely((rb->frames_per_block * req->tp_block_nr) !=
					req->tp_frame_nr))