netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] net/sched: remove unneeded NULL check
@ 2010-08-14 21:09 Dan Carpenter
  2010-08-16 10:14 ` Jarek Poplawski
  2010-08-18 21:27 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-08-14 21:09 UTC (permalink / raw)
  To: Jamal Hadi Salim
  Cc: David S. Miller, Patrick McHardy, Jarek Poplawski, Eric Dumazet,
	Stephen Hemminger, netdev, kernel-janitors

There is no need to check "s".  nla_data() doesn't return NULL.  Also we
already dereferenced "s" at this point so it would have oopsed ealier if
it were NULL.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 408eea7..6fb3d41 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -360,7 +360,7 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
 		tsize = nla_len(tb[TCA_STAB_DATA]) / sizeof(u16);
 	}
 
-	if (!s || tsize != s->tsize || (!tab && tsize > 0))
+	if (tsize != s->tsize || (!tab && tsize > 0))
 		return ERR_PTR(-EINVAL);
 
 	spin_lock(&qdisc_stab_lock);

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

* Re: [patch] net/sched: remove unneeded NULL check
  2010-08-14 21:09 [patch] net/sched: remove unneeded NULL check Dan Carpenter
@ 2010-08-16 10:14 ` Jarek Poplawski
  2010-08-18 21:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jarek Poplawski @ 2010-08-16 10:14 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jamal Hadi Salim, David S. Miller, Patrick McHardy, Eric Dumazet,
	Stephen Hemminger, netdev, kernel-janitors

Dan Carpenter wrote:
> There is no need to check "s".  nla_data() doesn't return NULL.  Also we
> already dereferenced "s" at this point so it would have oopsed ealier if
> it were NULL.

Looks OK to me.

Jarek P.

> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> index 408eea7..6fb3d41 100644
> --- a/net/sched/sch_api.c
> +++ b/net/sched/sch_api.c
> @@ -360,7 +360,7 @@ static struct qdisc_size_table *qdisc_get_stab(struct nlattr *opt)
>  		tsize = nla_len(tb[TCA_STAB_DATA]) / sizeof(u16);
>  	}
>  
> -	if (!s || tsize != s->tsize || (!tab && tsize > 0))
> +	if (tsize != s->tsize || (!tab && tsize > 0))
>  		return ERR_PTR(-EINVAL);
>  
>  	spin_lock(&qdisc_stab_lock);
> --

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

* Re: [patch] net/sched: remove unneeded NULL check
  2010-08-14 21:09 [patch] net/sched: remove unneeded NULL check Dan Carpenter
  2010-08-16 10:14 ` Jarek Poplawski
@ 2010-08-18 21:27 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-08-18 21:27 UTC (permalink / raw)
  To: error27
  Cc: hadi, kaber, jarkao2, eric.dumazet, shemminger, netdev,
	kernel-janitors

From: Dan Carpenter <error27@gmail.com>
Date: Sat, 14 Aug 2010 23:09:49 +0200

> There is no need to check "s".  nla_data() doesn't return NULL.  Also we
> already dereferenced "s" at this point so it would have oopsed ealier if
> it were NULL.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied.

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

end of thread, other threads:[~2010-08-18 21:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-14 21:09 [patch] net/sched: remove unneeded NULL check Dan Carpenter
2010-08-16 10:14 ` Jarek Poplawski
2010-08-18 21:27 ` 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).