All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] packet: Don't check frames_per_block against negative values
@ 2015-11-17  9:38 Tobias Klauser
  2015-11-17 20:26 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2015-11-17  9:38 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

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>
---
 net/packet/af_packet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index af399ca..4c27ae76 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4119,8 +4119,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))
-- 
2.6.3.368.gf34be46.dirty

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] packet: Don't check frames_per_block against negative values
  2015-11-17  9:38 [PATCH] packet: Don't check frames_per_block against negative values Tobias Klauser
@ 2015-11-17 20:26 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-11-17 20:26 UTC (permalink / raw)
  To: tklauser; +Cc: netdev

From: Tobias Klauser <tklauser@distanz.ch>
Date: Tue, 17 Nov 2015 10:38:36 +0100

> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-17 20:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-17  9:38 [PATCH] packet: Don't check frames_per_block against negative values Tobias Klauser
2015-11-17 20:26 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.