* Re: [PATCH] mac80211: fix the endianness problem of HWMP sequence number in RANN propagation
2012-03-16 18:43 [PATCH] mac80211: fix the endianness problem of HWMP sequence number in RANN propagation Chun-Yeow Yeoh
@ 2012-03-16 12:40 ` Johannes Berg
2012-03-18 16:11 ` Yeoh Chun-Yeow
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-03-16 12:40 UTC (permalink / raw)
To: Chun-Yeow Yeoh; +Cc: linux-wireless, javier, linville, devel
On Sat, 2012-03-17 at 02:43 +0800, Chun-Yeow Yeoh wrote:
> The HWMP sequence number of received RANN element is compared to decide whether to be
> propagated. The sequence number is required to covert from 32bit little endian data into
> CPUs endianness for comparison.
>
> Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
> ---
> net/mac80211/mesh_hwmp.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
> index 1c6f3d0..2ccb3c9 100644
> --- a/net/mac80211/mesh_hwmp.c
> +++ b/net/mac80211/mesh_hwmp.c
> @@ -748,7 +748,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
> flags = rann->rann_flags;
> root_is_gate = !!(flags & RANN_FLAG_IS_GATE);
> orig_addr = rann->rann_addr;
> - orig_sn = rann->rann_seq;
> + orig_sn = le32_to_cpu(rann->rann_seq);
You should mark struct ieee80211_rann_ie to contain __le32, so that
sparse will warn about things like this.
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] mac80211: fix the endianness problem of HWMP sequence number in RANN propagation
@ 2012-03-16 18:43 Chun-Yeow Yeoh
2012-03-16 12:40 ` Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Chun-Yeow Yeoh @ 2012-03-16 18:43 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, javier, linville, devel, Chun-Yeow Yeoh
The HWMP sequence number of received RANN element is compared to decide whether to be
propagated. The sequence number is required to covert from 32bit little endian data into
CPUs endianness for comparison.
Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@gmail.com>
---
net/mac80211/mesh_hwmp.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 1c6f3d0..2ccb3c9 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -748,7 +748,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata,
flags = rann->rann_flags;
root_is_gate = !!(flags & RANN_FLAG_IS_GATE);
orig_addr = rann->rann_addr;
- orig_sn = rann->rann_seq;
+ orig_sn = le32_to_cpu(rann->rann_seq);
hopcount = rann->rann_hopcount;
hopcount++;
metric = rann->rann_metric;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: fix the endianness problem of HWMP sequence number in RANN propagation
2012-03-16 12:40 ` Johannes Berg
@ 2012-03-18 16:11 ` Yeoh Chun-Yeow
2012-03-18 16:32 ` Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Yeoh Chun-Yeow @ 2012-03-18 16:11 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, javier, devel
Hi, Johannes
>
> You should mark struct ieee80211_rann_ie to contain __le32, so that
> sparse will warn about things like this.
>
I try to change u32 to __le32 for the following members in struct
ieee80211_rann_ie.
struct ieee80211_rann_ie {
u8 rann_flags;
u8 rann_hopcount;
u8 rann_ttl;
u8 rann_addr[6];
__le32 rann_seq;
__le32 rann_interval;
__le32 rann_metric;
} __attribute__ ((packed));
But when I compile using "make C=2 CF=-D__CHECK_ENDIAN__", I don't see
any sparse warning on this.
Please advice. Thanks
Regards,
Chun-Yeow
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: fix the endianness problem of HWMP sequence number in RANN propagation
2012-03-18 16:11 ` Yeoh Chun-Yeow
@ 2012-03-18 16:32 ` Johannes Berg
2012-03-19 5:00 ` Yeoh Chun-Yeow
0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-03-18 16:32 UTC (permalink / raw)
To: Yeoh Chun-Yeow; +Cc: linux-wireless, javier, devel
Hi,
> > You should mark struct ieee80211_rann_ie to contain __le32, so that
> > sparse will warn about things like this.
> >
>
> I try to change u32 to __le32 for the following members in struct
> ieee80211_rann_ie.
>
> struct ieee80211_rann_ie {
> u8 rann_flags;
> u8 rann_hopcount;
> u8 rann_ttl;
> u8 rann_addr[6];
> __le32 rann_seq;
> __le32 rann_interval;
> __le32 rann_metric;
> } __attribute__ ((packed));
>
> But when I compile using "make C=2 CF=-D__CHECK_ENDIAN__", I don't see
> any sparse warning on this.
Not sure, if I make the above change I get:
CHECK net/mac80211/mesh_hwmp.c
net/mac80211/mesh_hwmp.c:751:17: warning: incorrect type in assignment (different base types)
net/mac80211/mesh_hwmp.c:751:17: expected unsigned int [unsigned] [usertype] orig_sn
net/mac80211/mesh_hwmp.c:751:17: got restricted __le32 [usertype] rann_seq
net/mac80211/mesh_hwmp.c:754:16: warning: incorrect type in assignment (different base types)
net/mac80211/mesh_hwmp.c:754:16: expected unsigned int [unsigned] [usertype] metric
net/mac80211/mesh_hwmp.c:754:16: got restricted __le32 [usertype] rann_metric
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: fix the endianness problem of HWMP sequence number in RANN propagation
2012-03-18 16:32 ` Johannes Berg
@ 2012-03-19 5:00 ` Yeoh Chun-Yeow
0 siblings, 0 replies; 5+ messages in thread
From: Yeoh Chun-Yeow @ 2012-03-19 5:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, javier, devel
Ok, I am able to generate the warnings. It seems that I need to
resolve the first error below, otherwise don't see the subsequent
warnings.
include/linux/skbuff.h:357:41: error: invalid bitfield specifier for
type restricted __be16.
Will submit patch with different naming since it involves the
rann->metric as well.
Chun-Yeow
On Mon, Mar 19, 2012 at 12:32 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> Hi,
>
>> > You should mark struct ieee80211_rann_ie to contain __le32, so that
>> > sparse will warn about things like this.
>> >
>>
>> I try to change u32 to __le32 for the following members in struct
>> ieee80211_rann_ie.
>>
>> struct ieee80211_rann_ie {
>> u8 rann_flags;
>> u8 rann_hopcount;
>> u8 rann_ttl;
>> u8 rann_addr[6];
>> __le32 rann_seq;
>> __le32 rann_interval;
>> __le32 rann_metric;
>> } __attribute__ ((packed));
>>
>> But when I compile using "make C=2 CF=-D__CHECK_ENDIAN__", I don't see
>> any sparse warning on this.
>
> Not sure, if I make the above change I get:
>
> CHECK net/mac80211/mesh_hwmp.c
> net/mac80211/mesh_hwmp.c:751:17: warning: incorrect type in assignment (different base types)
> net/mac80211/mesh_hwmp.c:751:17: expected unsigned int [unsigned] [usertype] orig_sn
> net/mac80211/mesh_hwmp.c:751:17: got restricted __le32 [usertype] rann_seq
> net/mac80211/mesh_hwmp.c:754:16: warning: incorrect type in assignment (different base types)
> net/mac80211/mesh_hwmp.c:754:16: expected unsigned int [unsigned] [usertype] metric
> net/mac80211/mesh_hwmp.c:754:16: got restricted __le32 [usertype] rann_metric
>
> johannes
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-19 5:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16 18:43 [PATCH] mac80211: fix the endianness problem of HWMP sequence number in RANN propagation Chun-Yeow Yeoh
2012-03-16 12:40 ` Johannes Berg
2012-03-18 16:11 ` Yeoh Chun-Yeow
2012-03-18 16:32 ` Johannes Berg
2012-03-19 5:00 ` Yeoh Chun-Yeow
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).