2019-01-05 08:23:33

by Július Milan

[permalink] [raw]
Subject: [PATCH] staging: wilc1000: fix cast to restricted __le32

Fixes the following sparse warnings:

drivers/staging/wilc1000/host_interface.c:2360:30: warning:
incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [assigned] [usertype] frame_type
got restricted __le16 [usertype] <noident>

Fixes: 147ccfd451024 ("staging: wilc1000: handle mgmt_frame_register ops from cfg82011 context")
Signed-off-by: J?lius Milan <[email protected]>
---
drivers/staging/wilc1000/host_interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 5dae6e7155d3..07c3d6293573 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2357,7 +2357,7 @@ void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
default:
break;
}
- reg_frame.frame_type = cpu_to_le16(frame_type);
+ reg_frame.frame_type = cpu_to_le32(frame_type);
result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
wilc_get_vif_idx(vif));
if (result)
--
2.14.5



2019-01-07 12:55:44

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: wilc1000: fix cast to restricted __le32

I'm sort of surprised that the zero day bot didn't complain about this.
It probably should.

The endianness checking is not turned on by default in Sparse. You have
to do "make C=1 CF=-D__CHECK_ENDIAN__" to turn it on.

regards,
dan carpenter

On Sat, Jan 05, 2019 at 09:23:23AM +0100, J?lius Milan wrote:
> Fixes the following sparse warnings:
>
> drivers/staging/wilc1000/host_interface.c:2360:30: warning:
> incorrect type in assignment (different base types)
> expected restricted __le32 [addressable] [assigned] [usertype] frame_type
> got restricted __le16 [usertype] <noident>
>
> Fixes: 147ccfd451024 ("staging: wilc1000: handle mgmt_frame_register ops from cfg82011 context")
> Signed-off-by: J?lius Milan <[email protected]>
> ---
> drivers/staging/wilc1000/host_interface.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
> index 5dae6e7155d3..07c3d6293573 100644
> --- a/drivers/staging/wilc1000/host_interface.c
> +++ b/drivers/staging/wilc1000/host_interface.c
> @@ -2357,7 +2357,7 @@ void wilc_frame_register(struct wilc_vif *vif, u16 frame_type, bool reg)
> default:
> break;
> }
> - reg_frame.frame_type = cpu_to_le16(frame_type);
> + reg_frame.frame_type = cpu_to_le32(frame_type);
> result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1,
> wilc_get_vif_idx(vif));
> if (result)
> --
> 2.14.5
>
> _______________________________________________
> devel mailing list
> [email protected]
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

2019-01-07 13:23:34

by Luc Van Oostenryck

[permalink] [raw]
Subject: Re: [PATCH] staging: wilc1000: fix cast to restricted __le32

On Mon, Jan 07, 2019 at 03:54:37PM +0300, Dan Carpenter wrote:
> I'm sort of surprised that the zero day bot didn't complain about this.
> It probably should.
>
> The endianness checking is not turned on by default in Sparse. You have
> to do "make C=1 CF=-D__CHECK_ENDIAN__" to turn it on.

Bitwise (and thus endian) checking is enabled by default in the kernel
since 05de97003 ("linux/types.h: enable endian checks for all sparse builds")
included in v4.10-rc1. Since then they make more than half of sparse
warnings (in a x86-64 allyesconfig).

Best regards,
-- Luc