mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
qcacld-3.0: Change the underlying type of mac_handle_t
Currently mac_handle_t is defined as a void pointer. This is convenient from an information hiding point of view since that means a non-MAC component cannot dereference a MAC handle to access MAC private data. However this is not convenient from a defect prevention point of view since the C standard allows any other pointer type to be freely and silently converted to and from a void pointer, and hence the compiler is unable to detect when a MAC handle is used in a context where a different pointer type is expected. An example of multiple such defects was addressed by Change-Id I01812b2390269805da4d1a5cb40a811d1e22ec56 (qcacld-3.0: Fix bad pointers being passed from SME to WMA). To help prevent these kinds of defects change the definition of mac_handle_t to be a pointer to an opaque struct. Change-Id: I72483bf0e693d6eca24355f31d3a1653b8f31302 CRs-Fixed: 2268814
This commit is contained in:
parent
1021f89889
commit
97dad0855d
1 changed files with 5 additions and 3 deletions
|
|
@ -42,10 +42,12 @@
|
|||
* pointer through this handle.
|
||||
*/
|
||||
/*
|
||||
* NOTE WELL: an upcoming change will replace the void * with an
|
||||
* opaque pointer just as is currently done with hdd_handle_t
|
||||
* NOTE WELL: struct opaque_mac_handle is not defined anywhere. This
|
||||
* reference is used to help ensure that a mac_handle_t is never used
|
||||
* where a different handle type is expected
|
||||
*/
|
||||
typedef void *mac_handle_t;
|
||||
struct opaque_mac_handle;
|
||||
typedef struct opaque_mac_handle *mac_handle_t;
|
||||
|
||||
/* retain legacy name until all instances have been replaced */
|
||||
typedef mac_handle_t tHalHandle;
|
||||
|
|
|
|||
Loading…
Reference in a new issue