diff mbox

[net-next,RESEND,2/2] ipv6: fix sparse warning

Message ID 1418201167-9591-3-git-send-email-ying.xue@windriver.com
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Ying Xue Dec. 10, 2014, 8:46 a.m. UTC
This fixes the following spare warning when using

make C=1 CF=-D__CHECK_ENDIAN__ net/ipv6/addrconf.o
net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)

To silence above spare complaint, an RCU annotation should be added
to "next" pointer of hlist_node structure through hlist_next_rcu()
macro when iterating over a hlist with
hlist_for_each_entry_continue_rcu_bh().

By the way, this commit also resolves the same error appearing in
hlist_for_each_entry_continue_rcu().

Signed-off-by: Ying Xue <ying.xue@windriver.com>
---
 include/linux/rculist.h |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Paul E. McKenney Dec. 10, 2014, 4:04 p.m. UTC | #1
On Wed, Dec 10, 2014 at 04:46:07PM +0800, Ying Xue wrote:
> This fixes the following spare warning when using
> 
> make C=1 CF=-D__CHECK_ENDIAN__ net/ipv6/addrconf.o
> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> 
> To silence above spare complaint, an RCU annotation should be added
> to "next" pointer of hlist_node structure through hlist_next_rcu()
> macro when iterating over a hlist with
> hlist_for_each_entry_continue_rcu_bh().
> 
> By the way, this commit also resolves the same error appearing in
> hlist_for_each_entry_continue_rcu().
> 
> Signed-off-by: Ying Xue <ying.xue@windriver.com>

If you pull the rculist.h changes from the first patch into this one,
I will queue it up through -rcu.

							Thanx, Paul

> ---
>  include/linux/rculist.h |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/include/linux/rculist.h b/include/linux/rculist.h
> index 866d9c9..32bd4ad 100644
> --- a/include/linux/rculist.h
> +++ b/include/linux/rculist.h
> @@ -524,11 +524,11 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
>   * @member:	the name of the hlist_node within the struct.
>   */
>  #define hlist_for_each_entry_continue_rcu(pos, member)			\
> -	for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
> -			typeof(*(pos)), member);			\
> +	for (pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \
> +			&(pos)->member)), typeof(*(pos)), member);	\
>  	     pos;							\
> -	     pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
> -			typeof(*(pos)), member))
> +	     pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(	\
> +			&(pos)->member)), typeof(*(pos)), member))
> 
>  /**
>   * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
> @@ -536,11 +536,11 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
>   * @member:	the name of the hlist_node within the struct.
>   */
>  #define hlist_for_each_entry_continue_rcu_bh(pos, member)		\
> -	for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
> -			typeof(*(pos)), member);			\
> +	for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(  \
> +			&(pos)->member)), typeof(*(pos)), member);	\
>  	     pos;							\
> -	     pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
> -			typeof(*(pos)), member))
> +	     pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(	\
> +			&(pos)->member)), typeof(*(pos)), member))
> 
>  /**
>   * hlist_for_each_entry_from_rcu - iterate over a hlist continuing from current point
> -- 
> 1.7.9.5
> 

--
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
Ying Xue Dec. 11, 2014, 1:56 a.m. UTC | #2
On 12/11/2014 12:04 AM, Paul E. McKenney wrote:
> On Wed, Dec 10, 2014 at 04:46:07PM +0800, Ying Xue wrote:
>> This fixes the following spare warning when using
>>
>> make C=1 CF=-D__CHECK_ENDIAN__ net/ipv6/addrconf.o
>> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
>> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
>> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
>> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
>>
>> To silence above spare complaint, an RCU annotation should be added
>> to "next" pointer of hlist_node structure through hlist_next_rcu()
>> macro when iterating over a hlist with
>> hlist_for_each_entry_continue_rcu_bh().
>>
>> By the way, this commit also resolves the same error appearing in
>> hlist_for_each_entry_continue_rcu().
>>
>> Signed-off-by: Ying Xue <ying.xue@windriver.com>
> 
> If you pull the rculist.h changes from the first patch into this one,
> I will queue it up through -rcu.
> 

Please just queue this patch into your RCU tree. Some changes of the
first patch currently only exists in net-next tree, so it cannot be
merged into RCU tree now. Therefore, please temporarily ignore it. In
next 3.19 development cycle, I will resubmit it to you.

Thanks,
Ying

> 							Thanx, Paul
> 
>> ---
>>  include/linux/rculist.h |   16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/include/linux/rculist.h b/include/linux/rculist.h
>> index 866d9c9..32bd4ad 100644
>> --- a/include/linux/rculist.h
>> +++ b/include/linux/rculist.h
>> @@ -524,11 +524,11 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
>>   * @member:	the name of the hlist_node within the struct.
>>   */
>>  #define hlist_for_each_entry_continue_rcu(pos, member)			\
>> -	for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
>> -			typeof(*(pos)), member);			\
>> +	for (pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \
>> +			&(pos)->member)), typeof(*(pos)), member);	\
>>  	     pos;							\
>> -	     pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
>> -			typeof(*(pos)), member))
>> +	     pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(	\
>> +			&(pos)->member)), typeof(*(pos)), member))
>>
>>  /**
>>   * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
>> @@ -536,11 +536,11 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
>>   * @member:	the name of the hlist_node within the struct.
>>   */
>>  #define hlist_for_each_entry_continue_rcu_bh(pos, member)		\
>> -	for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
>> -			typeof(*(pos)), member);			\
>> +	for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(  \
>> +			&(pos)->member)), typeof(*(pos)), member);	\
>>  	     pos;							\
>> -	     pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
>> -			typeof(*(pos)), member))
>> +	     pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(	\
>> +			&(pos)->member)), typeof(*(pos)), member))
>>
>>  /**
>>   * hlist_for_each_entry_from_rcu - iterate over a hlist continuing from current point
>> -- 
>> 1.7.9.5
>>
> 
> 
> 

--
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
Paul E. McKenney Dec. 11, 2014, 5:02 p.m. UTC | #3
On Thu, Dec 11, 2014 at 09:56:33AM +0800, Ying Xue wrote:
> On 12/11/2014 12:04 AM, Paul E. McKenney wrote:
> > On Wed, Dec 10, 2014 at 04:46:07PM +0800, Ying Xue wrote:
> >> This fixes the following spare warning when using
> >>
> >> make C=1 CF=-D__CHECK_ENDIAN__ net/ipv6/addrconf.o
> >> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> >> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> >> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> >> net/ipv6/addrconf.c:3495:9: error: incompatible types in comparison expression (different address spaces)
> >>
> >> To silence above spare complaint, an RCU annotation should be added
> >> to "next" pointer of hlist_node structure through hlist_next_rcu()
> >> macro when iterating over a hlist with
> >> hlist_for_each_entry_continue_rcu_bh().
> >>
> >> By the way, this commit also resolves the same error appearing in
> >> hlist_for_each_entry_continue_rcu().
> >>
> >> Signed-off-by: Ying Xue <ying.xue@windriver.com>
> > 
> > If you pull the rculist.h changes from the first patch into this one,
> > I will queue it up through -rcu.
> 
> Please just queue this patch into your RCU tree. Some changes of the
> first patch currently only exists in net-next tree, so it cannot be
> merged into RCU tree now. Therefore, please temporarily ignore it. In
> next 3.19 development cycle, I will resubmit it to you.

Sounds good, but could you please rebase the second patch to be
independent of the first patch?  If you do that, I would be happy
to queue it.

							Thanx, Paul

> Thanks,
> Ying
> 
> > 							Thanx, Paul
> > 
> >> ---
> >>  include/linux/rculist.h |   16 ++++++++--------
> >>  1 file changed, 8 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/include/linux/rculist.h b/include/linux/rculist.h
> >> index 866d9c9..32bd4ad 100644
> >> --- a/include/linux/rculist.h
> >> +++ b/include/linux/rculist.h
> >> @@ -524,11 +524,11 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
> >>   * @member:	the name of the hlist_node within the struct.
> >>   */
> >>  #define hlist_for_each_entry_continue_rcu(pos, member)			\
> >> -	for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
> >> -			typeof(*(pos)), member);			\
> >> +	for (pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \
> >> +			&(pos)->member)), typeof(*(pos)), member);	\
> >>  	     pos;							\
> >> -	     pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
> >> -			typeof(*(pos)), member))
> >> +	     pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(	\
> >> +			&(pos)->member)), typeof(*(pos)), member))
> >>
> >>  /**
> >>   * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
> >> @@ -536,11 +536,11 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n,
> >>   * @member:	the name of the hlist_node within the struct.
> >>   */
> >>  #define hlist_for_each_entry_continue_rcu_bh(pos, member)		\
> >> -	for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
> >> -			typeof(*(pos)), member);			\
> >> +	for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(  \
> >> +			&(pos)->member)), typeof(*(pos)), member);	\
> >>  	     pos;							\
> >> -	     pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
> >> -			typeof(*(pos)), member))
> >> +	     pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(	\
> >> +			&(pos)->member)), typeof(*(pos)), member))
> >>
> >>  /**
> >>   * hlist_for_each_entry_from_rcu - iterate over a hlist continuing from current point
> >> -- 
> >> 1.7.9.5
> >>
> > 
> > 
> > 
> 

--
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
diff mbox

Patch

diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 866d9c9..32bd4ad 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -524,11 +524,11 @@  static inline void hlist_add_behind_rcu(struct hlist_node *n,
  * @member:	the name of the hlist_node within the struct.
  */
 #define hlist_for_each_entry_continue_rcu(pos, member)			\
-	for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
-			typeof(*(pos)), member);			\
+	for (pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \
+			&(pos)->member)), typeof(*(pos)), member);	\
 	     pos;							\
-	     pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\
-			typeof(*(pos)), member))
+	     pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu(	\
+			&(pos)->member)), typeof(*(pos)), member))
 
 /**
  * hlist_for_each_entry_continue_rcu_bh - iterate over a hlist continuing after current point
@@ -536,11 +536,11 @@  static inline void hlist_add_behind_rcu(struct hlist_node *n,
  * @member:	the name of the hlist_node within the struct.
  */
 #define hlist_for_each_entry_continue_rcu_bh(pos, member)		\
-	for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
-			typeof(*(pos)), member);			\
+	for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(  \
+			&(pos)->member)), typeof(*(pos)), member);	\
 	     pos;							\
-	     pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next),\
-			typeof(*(pos)), member))
+	     pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu(	\
+			&(pos)->member)), typeof(*(pos)), member))
 
 /**
  * hlist_for_each_entry_from_rcu - iterate over a hlist continuing from current point