configure network device with wireless extensions
the struct iwreq is found in linux/wireless.h you can simply include it and use the 'iwreq' struct.
misaligned address access crash on linux wifi drivers on arc platform
Simple. Just do the right thing. In general case, one would use memcpy
:
t_u32 value = wlan_cpu_to_le32((t_u32)ul_temp);
memcpy(psnmp_mib->value, &value, sizeof (t_u32));
As pointed out by 0andriy, the put_unaligned
could be used here:
put_unaligned(wlan_cpu_to_le32((t_u32)ul_temp), (t_u32*)psnmp_mib->value);
However this is very worrisome because the C standard does state that the behaviour is undefined when:
Conversion between two pointer types produces a result that is incorrectly aligned (6.3.2.3).
Thus even the mere presence of the cast (t_u32*)
can lead to the compiler to "realize" that the pointer psnmp_mib->value
is aligned to the alignment requirement of t_u32
anyway.
Unaligned access - or even casting pointers to unaligned structures - has undefined behaviour even on platforms that "supposedly" allow unaligned access "everywhere".
Related Topics
Cpu Usage Percent from Linux Server
How to Run a Mips Binary on X86 Platform
About Process Control Block in Os
How to Dynamically Add to $Path on Linux/Os X
Ansible Inside Script Command Not Found
Count the Number of Executable Files in Bash
Issue While Validating Bash Script
How to Setup the Passwords-Less Authentication Between Two Different Accounts
Why Would It Be Impossible to Fully Statically Link an Application
Linux Kernel Interrupt Handler Mutex Protection
Linux Makefile Structure and Documentation
Find and Replace in Shell Scripting
Detect the Presence of a Device When It's Hot Plugged in Linux
What Is the Fastest Way to Find All the File with the Same Inode
How to Reconfigure Oracle 10G Xe on Linux
Linux "Free -M": Total, Used and Free Memory Values Don't Add Up