diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> | 2021-07-30 16:42:01 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-07-30 17:22:52 +0200 |
commit | ddecf5556f7fdf871fa8ce26b376e3e8ae6213b6 (patch) | |
tree | e8527773c9e264f6f2a1e35eea5fb9e1490efb5d /net/nfc/nci/spi.c | |
parent | f2479c0a22948c5998938fa5bb9d98f9931791b7 (diff) | |
download | linux-ddecf5556f7fdf871fa8ce26b376e3e8ae6213b6.tar.gz |
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>
Diffstat (limited to 'net/nfc/nci/spi.c')
-rw-r--r-- | net/nfc/nci/spi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/nfc/nci/spi.c b/net/nfc/nci/spi.c index 7d8e10e27c20..0935527d1d12 100644 --- a/net/nfc/nci/spi.c +++ b/net/nfc/nci/spi.c @@ -27,7 +27,7 @@ #define CRC_INIT 0xFFFF -static int __nci_spi_send(struct nci_spi *nspi, struct sk_buff *skb, +static int __nci_spi_send(struct nci_spi *nspi, const struct sk_buff *skb, int cs_change) { struct spi_message m; |