LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: Fix incorrect types in arguments
@ 2021-08-05 13:11 Fabio M. De Francesco
  2021-08-05 15:41 ` Dan Carpenter
  0 siblings, 1 reply; 2+ messages in thread
From: Fabio M. De Francesco @ 2021-08-05 13:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Larry Finger, Dan Carpenter, linux-staging,
	linux-kernel
  Cc: Fabio M. De Francesco

GCC + Sparse emit warnings of passing incorrect type in arguments of 
some functions because of different base types. Fix them by changing 
the types of the parameters of the above-mentioned functions.
In the meantime, remove the unnecessary casts of those arguments
which are then passed to memcpy() within those same functions.

Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_br_ext.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index 27c8ec3b7d62..e4110d5bc6f2 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -134,37 +134,37 @@ static inline void __nat25_generate_ipv4_network_addr(unsigned char *networkAddr
 }
 
 static inline void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
-				unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
+				__be32 *ipxNetAddr, unsigned char *ipxNodeAddr)
 {
 	memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
 
 	networkAddr[0] = NAT25_IPX;
-	memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
+	memcpy(networkAddr+1, ipxNetAddr, 4);
 	memcpy(networkAddr+5, ipxNodeAddr, 6);
 }
 
 static inline void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
-				unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
+				__be32 *ipxNetAddr, __be16 *ipxSocketAddr)
 {
 	memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
 
 	networkAddr[0] = NAT25_IPX;
-	memcpy(networkAddr+1, (unsigned char *)ipxNetAddr, 4);
-	memcpy(networkAddr+5, (unsigned char *)ipxSocketAddr, 2);
+	memcpy(networkAddr+1, ipxNetAddr, 4);
+	memcpy(networkAddr+5, ipxSocketAddr, 2);
 }
 
 static inline void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
-				unsigned short *network, unsigned char *node)
+				__be16 *network, unsigned char *node)
 {
 	memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
 
 	networkAddr[0] = NAT25_APPLE;
-	memcpy(networkAddr+1, (unsigned char *)network, 2);
+	memcpy(networkAddr+1, network, 2);
 	networkAddr[3] = *node;
 }
 
 static inline void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
-				unsigned char *ac_mac, unsigned short *sid)
+				unsigned char *ac_mac, __be16 *sid)
 {
 	memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
 
-- 
2.32.0


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

* Re: [PATCH] staging: r8188eu: Fix incorrect types in arguments
  2021-08-05 13:11 [PATCH] staging: r8188eu: Fix incorrect types in arguments Fabio M. De Francesco
@ 2021-08-05 15:41 ` Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2021-08-05 15:41 UTC (permalink / raw)
  To: Fabio M. De Francesco
  Cc: Greg Kroah-Hartman, Larry Finger, linux-staging, linux-kernel

On Thu, Aug 05, 2021 at 03:11:08PM +0200, Fabio M. De Francesco wrote:
> GCC + Sparse emit warnings of passing incorrect type in arguments of 
> some functions because of different base types. Fix them by changing 
> the types of the parameters of the above-mentioned functions.
> In the meantime, remove the unnecessary casts of those arguments
> which are then passed to memcpy() within those same functions.
> 

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


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

end of thread, other threads:[~2021-08-05 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 13:11 [PATCH] staging: r8188eu: Fix incorrect types in arguments Fabio M. De Francesco
2021-08-05 15:41 ` Dan Carpenter

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