Skip to content

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

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions drivers/wifi/eswifi/eswifi_socket_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* a special meaning in the fdtable subsys.
*/
#define SD_TO_OBJ(sd) ((void *)(sd + 1))
#define OBJ_TO_SD(obj) (((int)obj) - 1)
#define OBJ_TO_SD(obj) (((intptr_t)obj) - 1)
/* Default socket context (50CE) */

Check notice on line 32 in drivers/wifi/eswifi/eswifi_socket_offload.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/eswifi/eswifi_socket_offload.c:32 -#define OBJ_TO_SD(obj) (((intptr_t)obj) - 1) +#define OBJ_TO_SD(obj) (((intptr_t)obj) - 1)
#define ESWIFI_INIT_CONTEXT INT_TO_POINTER(0x50CE)

static struct eswifi_dev *eswifi;
Expand All @@ -55,7 +55,7 @@
static int eswifi_socket_connect(void *obj, const struct sockaddr *addr,
socklen_t addrlen)
{
int sock = OBJ_TO_SD(obj);
intptr_t sock = OBJ_TO_SD(obj);
struct eswifi_off_socket *socket;
int ret;

Expand Down Expand Up @@ -94,7 +94,7 @@
static int eswifi_socket_listen(void *obj, int backlog)
{
struct eswifi_off_socket *socket;
int sock = OBJ_TO_SD(obj);
intptr_t sock = OBJ_TO_SD(obj);
int ret;

eswifi_lock(eswifi);
Expand All @@ -107,8 +107,8 @@
}

void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr,
unsigned int len, int val, void *data)
size_t len, int val, void *data)
{

Check notice on line 111 in drivers/wifi/eswifi/eswifi_socket_offload.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

drivers/wifi/eswifi/eswifi_socket_offload.c:111 -void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr, - size_t len, int val, void *data) +void __eswifi_socket_accept_cb(struct net_context *context, struct sockaddr *addr, size_t len, + int val, void *data)
struct sockaddr *addr_target = data;

memcpy(addr_target, addr, len);
Expand All @@ -117,7 +117,7 @@
static int __eswifi_socket_accept(void *obj, struct sockaddr *addr,
socklen_t *addrlen)
{
int sock = OBJ_TO_SD(obj);
intptr_t sock = OBJ_TO_SD(obj);
struct eswifi_off_socket *socket;
int ret;

Expand Down Expand Up @@ -146,7 +146,7 @@
socklen_t *addrlen)
{
int fd = zvfs_reserve_fd();
int sock;
intptr_t sock;

if (fd < 0) {
return -1;
Expand Down Expand Up @@ -240,7 +240,7 @@
static int eswifi_socket_setsockopt(void *obj, int level, int optname,
const void *optval, socklen_t optlen)
{
int sd = OBJ_TO_SD(obj);
intptr_t sd = OBJ_TO_SD(obj);
int ret;

if (IS_ENABLED(CONFIG_NET_SOCKETS_SOCKOPT_TLS) && level == SOL_TLS) {
Expand All @@ -265,7 +265,7 @@
static ssize_t eswifi_socket_send(void *obj, const void *buf, size_t len,
int flags)
{
int sock = OBJ_TO_SD(obj);
intptr_t sock = OBJ_TO_SD(obj);
struct eswifi_off_socket *socket;
int ret;
int offset;
Expand Down Expand Up @@ -320,7 +320,7 @@
static ssize_t eswifi_socket_recv(void *obj, void *buf, size_t max_len,
int flags)
{
int sock = OBJ_TO_SD(obj);
intptr_t sock = OBJ_TO_SD(obj);
struct eswifi_off_socket *socket;
int len = 0, ret = 0;
struct net_pkt *pkt;
Expand Down Expand Up @@ -400,7 +400,7 @@

static int eswifi_socket_close(void *obj)
{
int sock = OBJ_TO_SD(obj);
intptr_t sock = OBJ_TO_SD(obj);
struct eswifi_off_socket *socket;
struct net_pkt *pkt;
int ret;
Expand Down Expand Up @@ -467,7 +467,8 @@
{
struct eswifi_off_socket *socket;
k_timeout_t timeout;
int sock, ret;
intptr_t sock;
int ret;
void *obj;

if (nfds != 1) {
Expand Down Expand Up @@ -540,7 +541,7 @@
static int eswifi_socket_bind(void *obj, const struct sockaddr *addr,
socklen_t addrlen)
{
int sock = OBJ_TO_SD(obj);
intptr_t sock = OBJ_TO_SD(obj);
struct eswifi_off_socket *socket;
int ret;

Expand Down Expand Up @@ -582,7 +583,7 @@
int eswifi_socket_create(int family, int type, int proto)
{
int fd = zvfs_reserve_fd();
int sock;
intptr_t sock;

if (fd < 0) {
return -1;
Expand Down
Loading