Patchwork wimax: checking ERR_PTR vs null

login
register
mail settings
Submitter Dan Carpenter
Date April 22, 2010, 9:50 a.m.
Message ID <20100422095010.GN29647@bicker>
Download mbox | patch
Permalink /patch/50718/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - April 22, 2010, 9:50 a.m.
stch_skb is allocated with wimax_gnl_re_state_change_alloc().  That
function returns ERR_PTRs on failure and doesn't return NULL.

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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Perez-Gonzalez, Inaky - April 22, 2010, 10:56 p.m.
On Thu, 2010-04-22 at 02:50 -0700, Dan Carpenter wrote: 
> stch_skb is allocated with wimax_gnl_re_state_change_alloc().  That
> function returns ERR_PTRs on failure and doesn't return NULL.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

ACK, thanks [and thanks to davem for reminding me]


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/wimax/stack.c b/net/wimax/stack.c
index 1ed65db..62b1a66 100644
--- a/net/wimax/stack.c
+++ b/net/wimax/stack.c
@@ -315,7 +315,7 @@  void __wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state)
 		BUG();
 	}
 	__wimax_state_set(wimax_dev, new_state);
-	if (stch_skb)
+	if (!IS_ERR(stch_skb))
 		wimax_gnl_re_state_change_send(wimax_dev, stch_skb, header);
 out:
 	d_fnend(3, dev, "(wimax_dev %p new_state %u [old %u]) = void\n",