From: Greg KH <gregkh@linuxfoundation.org>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: devel@driverdev.osuosl.org, netdev@vger.kernel.org
Subject: Re: [RFC] staging: r8188eu: Fix sparse warnings in core/rtw_br_ext.c
Date: Sat, 21 Dec 2013 23:37:03 -0800 [thread overview]
Message-ID: <20131222073703.GA27638@kroah.com> (raw)
In-Reply-To: <1387675868-18221-1-git-send-email-Larry.Finger@lwfinger.net>
On Sat, Dec 21, 2013 at 07:31:08PM -0600, Larry Finger wrote:
> 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.c
> drivers/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] check
> drivers/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(-)
>
> diff --git a/drivers/staging/rtl8188eu/core/rtw_br_ext.c b/drivers/staging/rtl8188eu/core/rtw_br_ext.c
> index 5425bc5..54a706f 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_br_ext.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_br_ext.c
>
> @@ -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
prev parent reply other threads:[~2013-12-22 7:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-22 1:31 [RFC] staging: r8188eu: Fix sparse warnings in core/rtw_br_ext.c Larry Finger
2013-12-22 7:37 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131222073703.GA27638@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Larry.Finger@lwfinger.net \
--cc=devel@driverdev.osuosl.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.