qcacld-3.0: Change the underlying type of hdd_handle_t

Currently hdd_handle_t is defined as a void pointer. This is
convenient from an information hiding point of view since that means a
non-HDD component cannot dereference an HDD handle to access HDD
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 an HDD handle is used in a
context where a different pointer type is expected.

An example of one such defect was addressed by Change-Id
I2bbf1bf4a7975e5cb44066b6a3b1a98e82df9fad (qcacld-3.0: Fix bad param
passed during QoS Map conversion).

To help prevent this kind of defect change the definition of
hdd_handle_t to be a pointer to an opaque struct.

Change-Id: I6e885f84c0554bbe5c8582474fddb65ab6a0fdac
CRs-Fixed: 2254907
This commit is contained in:
Jeff Johnson
2018-06-03 08:31:46 -07:00
committed by nshrivas
szülő b8f86ea873
commit f8406bf8c9

Fájl megtekintése

@@ -51,7 +51,13 @@ typedef void *tHalHandle;
* The HDD must be able to derive it's internal instance structure
* pointer through this handle.
*/
typedef void *hdd_handle_t;
/*
* NOTE WELL: struct opaque_hdd_handle is not defined anywhere. This
* reference is used to help ensure that a hdd_handle_t is never used
* where a different handle type is expected
*/
struct opaque_hdd_handle;
typedef struct opaque_hdd_handle *hdd_handle_t;
/* ********************************************** *
* *