Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1679641

Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c

From Janusz Lisiecki <janusz.lisiecki@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c
Date 2017-07-03 06:50 +0200
Message-ID <tZ1t7-4u1-9@gated-at.bofh.it> (permalink)
References <tYQR3-58Q-11@gated-at.bofh.it> <tYQR3-58Q-9@gated-at.bofh.it> <tYSSS-6BU-19@gated-at.bofh.it> <tYU8i-7p8-25@gated-at.bofh.it> <tYUBk-7Xp-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


W dniu 2017-07-02 o 23:23, Luc Van Oostenryck pisze:
> On Sun, Jul 2, 2017 at 10:49 PM, Janusz Lisiecki
> <janusz.lisiecki@gmail.com> wrote:
>> W dniu 2017-07-02 o 21:38, Luc Van Oostenryck pisze:
>>
>>> On Sun, Jul 2, 2017 at 4:27 PM, Janusz Lisiecki
>>> <janusz.lisiecki@gmail.com> wrote:
>>>> This patch fixes the following Sparse warnings in ks_wlan_net.c:
>>>> drivers/staging/ks7010/ks_wlan_net.c:1359:24: warning: cast to restricted
>>>> __le16
>>>> Both sides of assignment are u16 so (as 'ap' is local_ap_t type and
>>>> 'capability' member,
>>>> have the same as local 'capabilities' type of u16) 'le16_to_cpu' is not
>>>> needed
>>> It could be that it's ap->capability's type that is wrong (not
>>> annotated with __le16).
>>> Isn't it?
>>>
>>> Is ap->capability supposed to hold a little-endian value or a native
>>> order value?
>>>
>>> -- Luc
>> As I see in ks_hostif.c all assignments to link_ap_info_t->capability threat
>> this value as native order (i.e get_ap_information, get_current_ap). As this
>> is not a structure which comes from HW we can do the way you suggested.
>> Still, as all other places in code threats this as native order value I
>> decided to change only one place than many other around to fix Sparse
>> warning.
> Fine, but then please put this explanation in the commit message.
> In others words, be very clear that the change is because ap->capability is in
> native order and thus the conversion le16_to_cpu() is wrong and must be removed.
>
> -- Luc
Done. I hope my message is more verbose and clear this time.

Pozdrawiam,
Janusz Lisiecki


Pozdrawiam,
Janusz Lisiecki

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c Janusz Lisiecki <janusz.lisiecki@gmail.com> - 2017-07-02 19:30 +0200
  Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c Luc Van Oostenryck <luc.vanoostenryck@gmail.com> - 2017-07-02 21:40 +0200
    Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in  ks_wlan_net.c Janusz Lisiecki <janusz.lisiecki@gmail.com> - 2017-07-02 23:00 +0200
      Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c Luc Van Oostenryck <luc.vanoostenryck@gmail.com> - 2017-07-02 23:30 +0200
        Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in  ks_wlan_net.c Janusz Lisiecki <janusz.lisiecki@gmail.com> - 2017-07-03 06:50 +0200

csiph-web