• Krzysztof Kozlowski's avatar
    nfc: nci: constify several pointers to u8, sk_buff and other structs · ddecf555
    Krzysztof Kozlowski authored
    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: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    ddecf555
nci_core.h 12.9 KB