nfc: nci: constify several pointers to u8, sk_buff and other structs
Several functions receive pointers to u8, sk_buff or other structs but do not modify the contents so make them const. This allows doing the same for local variables and in total makes the code a little bit safer. This makes const also data passed as "unsigned long opt" argument to nci_request() function. Usual flow for such functions is: 1. Receive "u8 *" and store it (the pointer) in a structure allocated on stack (e.g. struct nci_set_config_param), 2. Call nci_request() or __nci_request() passing a callback function an the pointer to the structure via an "unsigned long opt", 3. nci_request() calls the callback which dereferences "unsigned long opt" in a read-only way. This converts all above paths to use proper pointer to const data, so entire flow is safer. Signed-off-by:Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by:
Jakub Kicinski <kuba@kernel.org>
Showing
- include/net/nfc/nci_core.h 8 additions, 6 deletionsinclude/net/nfc/nci_core.h
- net/nfc/nci/core.c 21 additions, 19 deletionsnet/nfc/nci/core.c
- net/nfc/nci/data.c 6 additions, 6 deletionsnet/nfc/nci/data.c
- net/nfc/nci/hci.c 12 additions, 12 deletionsnet/nfc/nci/hci.c
- net/nfc/nci/ntf.c 45 additions, 38 deletionsnet/nfc/nci/ntf.c
- net/nfc/nci/rsp.c 25 additions, 21 deletionsnet/nfc/nci/rsp.c
- net/nfc/nci/spi.c 1 addition, 1 deletionnet/nfc/nci/spi.c
Please register or sign in to comment