From: Tobias Klauser Date: Tue, 17 Nov 2015 09:38:36 +0000 (+0100) Subject: packet: Don't check frames_per_block against negative values X-Git-Tag: Ubuntu-5.2.0-15.16~10248^2~6 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=4194b4914a824c21bcad9305d6180825f4dc1f5e;p=mirror_ubuntu-eoan-kernel.git 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: Tobias Klauser Signed-off-by: David S. Miller --- diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 242bce1cf0f3..533981d49290 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -4121,8 +4121,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, if (unlikely(req->tp_frame_size & (TPACKET_ALIGNMENT - 1))) goto out; - rb->frames_per_block = req->tp_block_size/req->tp_frame_size; - if (unlikely(rb->frames_per_block <= 0)) + rb->frames_per_block = req->tp_block_size / req->tp_frame_size; + if (unlikely(rb->frames_per_block == 0)) goto out; if (unlikely((rb->frames_per_block * req->tp_block_nr) != req->tp_frame_nr))