staging: r8188eu: Fix sparse warnings in core/rtw_br_ext.c
Subsystems (3)
RFC 1/1 staging: r8188eu: Fix sparse warnings in core/rtw_br_ext.c
Please tell me if the following fixes are appropriate. In particular, I am uncertain of the __force attributes.
Thanks,
Larry
Sparse lists the following:
CHECK drivers/staging/rtl8188eu/core/rtw_br_ext.cdrivers/staging/rtl8188eu/core/rtw_br_ext.c:1156:63: warning: restricted __sum16 degrades to integer drivers/staging/rtl8188eu/core/rtw_br_ext.c:1160:69: warning: incorrect type in assignment (different base types)drivers/staging/rtl8188eu/core/rtw_br_ext.c:1160:69: expected restricted __sum16 [usertype] checkdrivers/staging/rtl8188eu/core/rtw_br_ext.c:1160:69: got int
--- drivers/staging/rtl8188eu/core/rtw_br_ext.c | 47 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 23 deletions(-)
drivers/staging/rtl8188eu/core/rtw_br_ext.c +0 -0
@@ -1153,11 +1154,11 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
/* or BROADCAST flag */ dhcph->flags |= htons(BROADCAST_FLAG); /* recalculate checksum */
- sum = ~(udph->check) & 0xffff;
+ sum = (__force int)(~(udph->check)) & 0xffff;
sum += be16_to_cpu(dhcph->flags); while (sum >> 16)
sum = (sum & 0xffff) + (sum >> 16);
- udph->check = ~sum;
+ udph->check = (__force __sum16)(~sum);
}
}
}
Signature · 1 line
1.8.4
Greg KH
maintainerQuoted 26 lines · Larry Finger
Please tell me if the following fixes are appropriate. In particular, I am uncertain of the
__forceattributes.Thanks,
Larry
Sparse lists the following:
CHECK
drivers/staging/rtl8188eu/core/rtw_br_ext.cdrivers/staging/rtl8188eu/core/rtw_br_ext.c:1156:63: warning: restricted__sum16degrades to integerdrivers/staging/rtl8188eu/core/rtw_br_ext.c:1160:69: warning: incorrect type in assignment (different base types)drivers/staging/rtl8188eu/core/rtw_br_ext.c:1160:69: expected restricted__sum16[usertype] checkdrivers/staging/rtl8188eu/core/rtw_br_ext.c:1160:69: got int--- drivers/staging/rtl8188eu/core/rtw_br_ext.c | 47 +++++++++++++++-------------- 1 file changed, 24 insertions(+), 23 deletions(-)drivers/staging/rtl8188eu/core/rtw_br_ext.c +0
-0
drivers/staging/rtl8188eu/core/rtw_br_ext.c void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb) · line 1161
Quoted 10 lines
drivers/staging/rtl8188eu/core/rtw_br_ext.c +2
-2@@ -1153,11 +1154,11 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)/* or BROADCAST flag */ dhcph->flags |=htons (BROADCAST_FLAG );/* recalculate checksum */ - sum = ~(udph->check) &0xffff ; + sum = (__force int )(~(udph->check)) &0xffff ; sum +=be16_to_cpu (dhcph->flags);while (sum >>16 ) sum = (sum &0xffff ) + (sum >>16 ); - udph->check = ~sum; + udph->check = (__force __sum16)(~sum);
I thought __force was only "needed" when trying to move between user and kernel pointer types, I didn't think it was needed for stuff like this.
But I really don't know what __sum16 is, so I can't say for sure, sorry.
greg k-h