From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Arend van Spriel <arend@broadcom.com>
Cc: Chris Ruffin <cmruffin@gmail.com>,
<linux-wireless@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<devel@driverdev.osuosl.org>,
Larry Finger <Larry.Finger@lwfinger.net>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] staging: rtl8723au: change typecast to match type returned by htons()
Date: Mon, 10 Nov 2014 16:09:37 -0500 [thread overview]
Message-ID: <wrfj8ujivk32.fsf@redhat.com> (raw)
In-Reply-To: <54611FF5.40405@broadcom.com> (Arend van Spriel's message of "Mon, 10 Nov 2014 21:28:37 +0100")
Arend van Spriel <arend@broadcom.com> writes:
> On 10-11-14 21:21, Jes Sorensen wrote:
>> Chris Ruffin <cmruffin@gmail.com> writes:
>>> Using a u16 pointer typecast for a result from htons() results in
>>> the following warning from sparse:
>>>
>>> drivers/staging/rtl8723au/core/rtw_xmit.c:1279:36: warning:
>>> incorrect type in assignment (different base types)
>>> drivers/staging/rtl8723au/core/rtw_xmit.c:1279:36: expected
>>> unsigned short [unsigned] [short] [usertype] <noident>
>>> drivers/staging/rtl8723au/core/rtw_xmit.c:1279:36: got restricted
>>> __be16 [usertype] <noident>
>>>
>>> This patch fixes the issue by using an endian-specific typecast
>>> that will always match the type returned by htons().
>>>
>>> Signed-off-by: Chris Ruffin <cmruffin@gmail.com>
>>> ---
>>> drivers/staging/rtl8723au/core/rtw_xmit.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> Looks fine to me
>>
>> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
>>
>>>
>>> diff --git a/drivers/staging/rtl8723au/core/rtw_xmit.c
>>> b/drivers/staging/rtl8723au/core/rtw_xmit.c
>>> index a0f7e27..44ef55c 100644
>>> --- a/drivers/staging/rtl8723au/core/rtw_xmit.c
>>> +++ b/drivers/staging/rtl8723au/core/rtw_xmit.c
>>> @@ -1276,7 +1276,7 @@ s32 rtw_put_snap23a(u8 *data, u16 h_proto)
>>> snap->oui[0] = oui[0];
>>> snap->oui[1] = oui[1];
>>> snap->oui[2] = oui[2];
>>> - *(u16 *)(data + SNAP_SIZE) = htons(h_proto);
>>> + *(__be16 *)(data + SNAP_SIZE) = htons(h_proto);
>
> Could (data + SNAP_SIZE) be on a unaligned address?
It shouldn't but probably better to take it into account. I am moving
things around in this code right now, so I'll just fix it in a follow-on
patch to this one.
Cheers,
Jes
prev parent reply other threads:[~2014-11-10 21:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-10 20:07 [PATCH] staging: rtl8723au: change typecast to match type returned by htons() Chris Ruffin
2014-11-10 20:21 ` Jes Sorensen
2014-11-10 20:28 ` Arend van Spriel
2014-11-10 21:09 ` Jes Sorensen [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=wrfj8ujivk32.fsf@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=Larry.Finger@lwfinger.net \
--cc=arend@broadcom.com \
--cc=cmruffin@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@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 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).