netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NET: catch signed nla_len() retval in tcf_simp_init()
@ 2008-04-17  3:33 Roel Kluin
  2008-04-17  4:37 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Roel Kluin @ 2008-04-17  3:33 UTC (permalink / raw)
  To: hadi, netdev, lkml

'datalen' is unsigned, use 'ret' instead to catch a negative return value.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
---
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index fbde461..b78d015 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -114,9 +114,10 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
 	if (defdata == NULL)
 		return -EINVAL;
 
-	datalen = nla_len(tb[TCA_DEF_DATA]);
-	if (datalen <= 0)
+	ret = nla_len(tb[TCA_DEF_DATA]);
+	if (ret <= 0)
 		return -EINVAL;
+	datalen = ret;
 
 	pc = tcf_hash_check(parm->index, a, bind, &simp_hash_info);
 	if (!pc) {

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

end of thread, other threads:[~2008-04-18  6:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-17  3:33 [PATCH] NET: catch signed nla_len() retval in tcf_simp_init() Roel Kluin
2008-04-17  4:37 ` David Miller
2008-04-17  4:55   ` Patrick McHardy
2008-04-17 12:58     ` jamal
2008-04-17 13:10       ` Patrick McHardy
2008-04-17 13:36         ` jamal
2008-04-18  6:20     ` 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).