[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <464cbdb48b238d6b3aca435ef4f0bd05d48e01c6.1629563318.git.aakashhemadri123@gmail.com>
Date: Mon, 23 Aug 2021 22:30:29 +0530
From: Aakash Hemadri <aakashhemadri123@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Larry Finger <Larry.Finger@...inger.net>,
Phillip Potter <phil@...lpotter.co.uk>
Cc: linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: [PATCH v4 4/5] staging: r8188eu: restricted __be16 degrades to int
Fix sparse warning:
> rtw_br_ext.c:839:70: warning: restricted __be16 degrades to integer
> rtw_br_ext.c:845:70: warning: invalid assignment: |=
> rtw_br_ext.c:845:70: left side has type unsigned short
> rtw_br_ext.c:845:70: right side has type restricted __be16
dhcp->flag is be16. Change htons() to cpu_to_be16() for clarity.
Signed-off-by: Aakash Hemadri <aakashhemadri123@...il.com>
---
Incorrectly removed htons() to satisfy sparse warning. Instead changed to
appropriate type and changed htons to cpu_to_be16 for clarity.
drivers/staging/r8188eu/core/rtw_br_ext.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index 26606093a3c3..83a4594a4214 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -641,7 +641,7 @@ struct dhcpMessage {
u_int8_t hops;
u_int32_t xid;
u_int16_t secs;
- u_int16_t flags;
+ __be16 flags;
u_int32_t ciaddr;
u_int32_t yiaddr;
u_int32_t siaddr;
@@ -674,13 +674,13 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
u32 cookie = be32_to_cpu(dhcph->cookie);
if (cookie == DHCP_MAGIC) { /* match magic word */
- if (!(dhcph->flags & htons(BROADCAST_FLAG))) {
+ if (!(dhcph->flags & cpu_to_be16(BROADCAST_FLAG))) {
/* if not broadcast */
register int sum = 0;
DEBUG_INFO("DHCP: change flag of DHCP request to broadcast.\n");
/* or BROADCAST flag */
- dhcph->flags |= htons(BROADCAST_FLAG);
+ dhcph->flags |= cpu_to_be16(BROADCAST_FLAG);
/* recalculate checksum */
sum = ~(udph->check) & 0xffff;
sum += be16_to_cpu(dhcph->flags);
--
2.32.0
Powered by blists - more mailing lists