Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: wifi: eswifi: fix casts for 64 bit pointers #80243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danieldegrasse
Copy link
Collaborator

@danieldegrasse danieldegrasse commented Oct 22, 2024

The eswifi driver uses an integer to identify the socket used for each connection, which must be cast to and from a void *. This causes warnings on 64 bit platforms, as precision is lost when casting from a void * to int. Use a uintptr_t type to store the socket value to resolve this warning. Also, fix a function signature for the accept_cb to use size_t instead of int for the length

Fixes #80242

@@ -582,7 +583,7 @@ static bool eswifi_socket_is_supported(int family, int type, int proto)
int eswifi_socket_create(int family, int type, int proto)
{
int fd = zvfs_reserve_fd();
int sock;
uintptr_t sock;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be intptr_t as the value can be negative?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should be- let me fix this

The eswifi driver uses an integer to identify the socket used for each
connection, which must be cast to and from a `void *`. This causes
warnings on 64 bit platforms, as precision is lost when casting from a
`void *` to `int`. Use a `intptr_t` type to store the socket value to
resolve this warning. Also, fix a function signature for the `accept_cb`
to use `size_t` instead of `int` for the length

Fixes zephyrproject-rtos#80242

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tests/drivers/build_all/wifi fails on native_sim/native/64
3 participants