* [PATCH 5/5] net: dccp: fix sign bug
@ 2010-07-17 15:21 Kulikov Vasiliy
2010-07-18 22:07 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Kulikov Vasiliy @ 2010-07-17 15:21 UTC (permalink / raw)
To: kernel-janitors
Cc: Arnaldo Carvalho de Melo, David S. Miller, Gerrit Renker, dccp,
netdev
'gap' is unsigned, so this code is wrong:
gap = -new_head;
...
if (gap > 0) { ... }
Make 'gap' signed.
The semantic patch that finds this problem (many false-positive results):
(http://coccinelle.lip6.fr/)
// <smpl>
@ r1 @
identifier f;
@@
int f(...) { ... }
@@
identifier r1.f;
type T;
unsigned T x;
@@
*x = f(...)
...
*x > 0
Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
---
net/dccp/ackvec.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/dccp/ackvec.c b/net/dccp/ackvec.c
index 2abddee..92a6fcb 100644
--- a/net/dccp/ackvec.c
+++ b/net/dccp/ackvec.c
@@ -201,7 +201,7 @@ static inline int dccp_ackvec_set_buf_head_state(struct dccp_ackvec *av,
const unsigned int packets,
const unsigned char state)
{
- unsigned int gap;
+ long gap;
long new_head;
if (av->av_vec_len + packets > DCCP_MAX_ACKVEC_LEN)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5/5] net: dccp: fix sign bug
2010-07-17 15:21 [PATCH 5/5] net: dccp: fix sign bug Kulikov Vasiliy
@ 2010-07-18 22:07 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-07-18 22:07 UTC (permalink / raw)
To: segooon; +Cc: kernel-janitors, acme, gerrit, dccp, netdev
From: Kulikov Vasiliy <segooon@gmail.com>
Date: Sat, 17 Jul 2010 19:21:00 +0400
> 'gap' is unsigned, so this code is wrong:
>
> gap = -new_head;
> ...
> if (gap > 0) { ... }
>
> Make 'gap' signed.
>
>
> The semantic patch that finds this problem (many false-positive results):
> (http://coccinelle.lip6.fr/)
...
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-18 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-17 15:21 [PATCH 5/5] net: dccp: fix sign bug Kulikov Vasiliy
2010-07-18 22:07 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).