lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] Purpose of memory alignment check


From: Boštjan Meglič
Subject: [lwip-devel] Purpose of memory alignment check
Date: Tue, 13 Mar 2012 12:45:42 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2

Hello,

In the lwip code src/api/sockets.c, line 117, what is the use of the following macro? Why should the name be aligned?
#define IS_SOCK_ADDR_ALIGNED(name)      ((((mem_ptr_t)(name)) % 4) == 0)

On our system (Texas Instruments DSP 5509) the code fails *sometimes* on the line 561: LWIP_ERROR("lwip_connect: invalid address", IS_SOCK_ADDR_LEN_VALID(namelen) && IS_SOCK_ADDR_TYPE_VALID_OR_UNSPEC(name) && IS_SOCK_ADDR_ALIGNED(name),
             sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1;);

After I removed the checking for memory alignment, everything works.

My question is, could there be a problem later on if I remove the memory alignment check?


Thanks,
Bostjan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]