linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Staging: wlan-ng: hfa384x_usb: Fixed sparse warning cast to restricted __le16
@ 2017-06-16 10:05 Jaya Durga
  2017-06-23 17:44 ` Greg KH
  2017-06-23 22:41 ` Frans Klaver
  0 siblings, 2 replies; 3+ messages in thread
From: Jaya Durga @ 2017-06-16 10:05 UTC (permalink / raw)
  To: gregkh
  Cc: sergio.paracuellos, adrien.descamps, devel, linux-kernel, Jaya Durga

when building with make C=1 CF=-D__CHECK_ENDIAN__

drivers/staging/wlan-ng/hfa384x_usb.c:3383:36: warning: cast to restricted __le16

fixed by using the le16_to_cpus function.

Signed-off-by: Jaya Durga <jayad@cdac.in>
---
 drivers/staging/wlan-ng/hfa384x_usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index a812e55..0e95e45 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3380,7 +3380,7 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
	u16 fc;

	/* Byte order convert once up front. */
-	usbin->rxfrm.desc.status = le16_to_cpu(usbin->rxfrm.desc.status);
+	le16_to_cpus(&usbin->rxfrm.desc.status);
	usbin->rxfrm.desc.time = le32_to_cpu(usbin->rxfrm.desc.time);

	/* Now handle frame based on port# */
--
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Staging: wlan-ng: hfa384x_usb: Fixed sparse warning cast to restricted __le16
  2017-06-16 10:05 [PATCH] Staging: wlan-ng: hfa384x_usb: Fixed sparse warning cast to restricted __le16 Jaya Durga
@ 2017-06-23 17:44 ` Greg KH
  2017-06-23 22:41 ` Frans Klaver
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2017-06-23 17:44 UTC (permalink / raw)
  To: Jaya Durga; +Cc: sergio.paracuellos, adrien.descamps, devel, linux-kernel

On Fri, Jun 16, 2017 at 03:35:07PM +0530, Jaya Durga wrote:
> when building with make C=1 CF=-D__CHECK_ENDIAN__
> 
> drivers/staging/wlan-ng/hfa384x_usb.c:3383:36: warning: cast to restricted __le16
> 
> fixed by using the le16_to_cpus function.
> 
> Signed-off-by: Jaya Durga <jayad@cdac.in>
> ---
>  drivers/staging/wlan-ng/hfa384x_usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Does not apply to my tree :(

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Staging: wlan-ng: hfa384x_usb: Fixed sparse warning cast to restricted __le16
  2017-06-16 10:05 [PATCH] Staging: wlan-ng: hfa384x_usb: Fixed sparse warning cast to restricted __le16 Jaya Durga
  2017-06-23 17:44 ` Greg KH
@ 2017-06-23 22:41 ` Frans Klaver
  1 sibling, 0 replies; 3+ messages in thread
From: Frans Klaver @ 2017-06-23 22:41 UTC (permalink / raw)
  To: Jaya Durga
  Cc: Greg KH, sergio.paracuellos, adrien.descamps, devel, linux-kernel

On Fri, Jun 16, 2017 at 12:05 PM, Jaya Durga <jayad@cdac.in> wrote:
> when building with make C=1 CF=-D__CHECK_ENDIAN__
>
> drivers/staging/wlan-ng/hfa384x_usb.c:3383:36: warning: cast to restricted __le16
>
> fixed by using the le16_to_cpus function.
>
> Signed-off-by: Jaya Durga <jayad@cdac.in>
> ---
>  drivers/staging/wlan-ng/hfa384x_usb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
> index a812e55..0e95e45 100644
> --- a/drivers/staging/wlan-ng/hfa384x_usb.c
> +++ b/drivers/staging/wlan-ng/hfa384x_usb.c
> @@ -3380,7 +3380,7 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb)
>         u16 fc;
>
>         /* Byte order convert once up front. */
> -       usbin->rxfrm.desc.status = le16_to_cpu(usbin->rxfrm.desc.status);
> +       le16_to_cpus(&usbin->rxfrm.desc.status);

Why is a cpu ordered value stored into a field that is documented to
be little endian? When this happens we can't rely on this variable
being little endian, can we? With the way things are now, at least
it's flagged by some tool. Come this patch, it won't be.

I don't think this patch fixes anything; it just tells sparse to shut up.

Frans

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-23 22:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16 10:05 [PATCH] Staging: wlan-ng: hfa384x_usb: Fixed sparse warning cast to restricted __le16 Jaya Durga
2017-06-23 17:44 ` Greg KH
2017-06-23 22:41 ` Frans Klaver

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).