diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-11-17 04:38:36 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-17 15:25:44 -0500 |
commit | 4194b4914a824c21bcad9305d6180825f4dc1f5e (patch) | |
tree | 9f8f042d945098206934bedc9326decbf92490b9 /net/packet | |
parent | 321beec5047af83db90c88114b7e664b156f49fe (diff) |
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 <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/packet')
-rw-r--r-- | net/packet/af_packet.c | 4 |
1 files changed, 2 insertions, 2 deletions
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, | |||
4121 | if (unlikely(req->tp_frame_size & (TPACKET_ALIGNMENT - 1))) | 4121 | if (unlikely(req->tp_frame_size & (TPACKET_ALIGNMENT - 1))) |
4122 | goto out; | 4122 | goto out; |
4123 | 4123 | ||
4124 | rb->frames_per_block = req->tp_block_size/req->tp_frame_size; | 4124 | rb->frames_per_block = req->tp_block_size / req->tp_frame_size; |
4125 | if (unlikely(rb->frames_per_block <= 0)) | 4125 | if (unlikely(rb->frames_per_block == 0)) |
4126 | goto out; | 4126 | goto out; |
4127 | if (unlikely((rb->frames_per_block * req->tp_block_nr) != | 4127 | if (unlikely((rb->frames_per_block * req->tp_block_nr) != |
4128 | req->tp_frame_nr)) | 4128 | req->tp_frame_nr)) |