Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1637104
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] drivers:staging:wlan-ng:hfa384x_usb: Fixing sparse warnings. |
| Date | 2017-05-08 00:20 +0200 |
| Message-ID | <tECH0-3sL-21@gated-at.bofh.it> (permalink) |
| References | <tAxPA-4Ed-7@gated-at.bofh.it> <tBZTr-5qZ-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Apr 30, 2017 at 6:26 PM, Karim Eshapa <karim.eshapa@gmail.com> wrote:
> On Fri, 28 Apr 2017 12:02:58 +0200, Greg KH wrote:
>> On Wed, Apr 26, 2017 at 06:15:40PM +0200, Karim Eshapa wrote:
>>
>>> Fixing sparse warnings incorrect type assignment.
>>>
>>> Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
>>> ---
>>> drivers/staging/wlan-ng/hfa384x_usb.c | 24 ++++++++++++++----------
>>> 1 file changed, 14 insertions(+), 10 deletions(-)
>>>
>>> diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
>>> index 6134eba..cf6bf65 100644
>>> --- a/drivers/staging/wlan-ng/hfa384x_usb.c
>>> +++ b/drivers/staging/wlan-ng/hfa384x_usb.c
>>> @@ -3511,20 +3511,24 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
>>> datap = skb_put(skb, sizeof(struct p80211_caphdr));
>>> caphdr = (struct p80211_caphdr *)datap;
>>>
>>> - caphdr->version = htonl(P80211CAPTURE_VERSION);
>>> - caphdr->length = htonl(sizeof(struct p80211_caphdr));
>>> + caphdr->version = __be32_to_cpu(htonl(P80211CAPTURE_VERSION));
>>> + caphdr->length = __be32_to_cpu( htonl(sizeof(
>>> + struct p80211_caphdr)));
>>>
>
>> How do you know this is correct? And why the odd ' ' usage? I can't
>> take this patch for that reason alone...
>>
>
> Actually using __be32_to_cpu may result in a problem if it's built for le machine.
> becasue if the network byte order needs to be represented in __be32 such that the
> header is going through the network in a right order.
> So, I suggest if we can change the structure's args type into __be32 that I don't
> trust it if it can force the arg to be big endian as it's defined as __attribute__((bitwise))
> that I'm not sure if it's GNU C attribute.
> that I didn't want from the beginning.
It sounds like the correct fix would be to change the type of the members
in p80211_caphdr.
Arnd
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] drivers:staging:wlan-ng:hfa384x_usb: Fixing sparse warnings. Karim Eshapa <karim.eshapa@gmail.com> - 2017-04-26 18:20 +0200
Re: [PATCH] drivers:staging:wlan-ng:hfa384x_usb: Fixing sparse warnings. Greg KH <gregkh@linuxfoundation.org> - 2017-04-28 12:10 +0200
RE:[PATCH] drivers:staging:wlan-ng:hfa384x_usb: Fixing sparse warnings. Karim Eshapa <karim.eshapa@gmail.com> - 2017-04-30 18:30 +0200
Re: [PATCH] drivers:staging:wlan-ng:hfa384x_usb: Fixing sparse warnings. Arnd Bergmann <arnd@arndb.de> - 2017-05-08 00:20 +0200
RE: [PATCH] drivers:staging:wlan-ng:hfa384x_usb: Fixing sparse warnings. Karim Eshapa <karim.eshapa@gmail.com> - 2017-05-10 15:20 +0200
csiph-web