2013-10-07 16:10:05

by Duan Jiong

[permalink] [raw]
Subject: [PATCH] mac80211: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

From: Duan Jiong <[email protected]>

Signed-off-by: Duan Jiong <[email protected]>
---
net/mac80211/key.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index 620677e..3e51dd7 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -879,7 +879,7 @@ ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
keyconf->keylen, keyconf->key,
0, NULL);
if (IS_ERR(key))
- return ERR_PTR(PTR_ERR(key));
+ return ERR_CAST(key);

if (sdata->u.mgd.mfp != IEEE80211_MFP_DISABLED)
key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT;
--
1.7.7.6



2013-10-07 16:17:05

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

On Mon, 2013-10-07 at 17:09 -0700, [email protected] wrote:

> if (IS_ERR(key))
> - return ERR_PTR(PTR_ERR(key));
> + return ERR_CAST(key);

I already have this patch in my tree.

johannes


2013-10-08 08:36:01

by David Laight

[permalink] [raw]
Subject: RE: [PATCH] mac80211: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

> Signed-off-by: Duan Jiong <[email protected]>
> ---
> net/mac80211/key.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/mac80211/key.c b/net/mac80211/key.c
> index 620677e..3e51dd7 100644
> --- a/net/mac80211/key.c
> +++ b/net/mac80211/key.c
> @@ -879,7 +879,7 @@ ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
> keyconf->keylen, keyconf->key,
> 0, NULL);
> if (IS_ERR(key))
> - return ERR_PTR(PTR_ERR(key));
> + return ERR_CAST(key);

I suspect the old code is a deliberate attempt to indicate that it
the error value that is being returned rather than the pointer.

Looking higher up that file there seems to be a fubar when setting
up the TKIP key.
It seems to put the same 6 bytes into every TID.
(I'm sure seq_len shouldn't be ignored either.0

David



2013-10-08 08:37:48

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

On Tue, 2013-10-08 at 09:33 +0100, David Laight wrote:

> > if (IS_ERR(key))
> > - return ERR_PTR(PTR_ERR(key));
> > + return ERR_CAST(key);
>
> I suspect the old code is a deliberate attempt to indicate that it
> the error value that is being returned rather than the pointer.

I was under the impression that's what ERR_CAST means.

> Looking higher up that file there seems to be a fubar when setting
> up the TKIP key.
> It seems to put the same 6 bytes into every TID.
> (I'm sure seq_len shouldn't be ignored either.0

Both are fine.

johannes