2019-06-03 07:44:50 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-14 16:43:05 +01:00
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2012-07-12 19:17:34 +02:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-15 11:47:34 -04:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-30 16:03:37 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-03 19:48:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2015-10-22 12:11:41 +03:00
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2015-10-22 12:11:41 +03:00
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-06-13 11:37:18 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
2015-10-22 12:11:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
2015-10-22 12:11:41 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-10 12:50:22 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-12-09 09:35:39 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-13 13:25:48 +08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-29 11:37:33 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:14 +01:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-15 22:56:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-09 12:09:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
net/nfc/nci: Support NCI 2.x initial sequence
implement the NCI 2.x initial sequence to support NCI 2.x NFCC.
Since NCI 2.0, CORE_RESET and CORE_INIT sequence have been changed.
If NFCEE supports NCI 2.x, then NCI 2.x initial sequence will work.
In NCI 1.0, Initial sequence and payloads are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status, NCI version, Configuration Status.
CORE_INIT_CMD payloads are empty.
CORE_INIT_RSP payloads are Status, NFCC Features,
Number of Supported RF Interfaces, Supported RF Interface,
Max Logical Connections, Max Routing table Size,
Max Control Packet Payload Size, Max Size for Large Parameters,
Manufacturer ID, Manufacturer Specific Information.
In NCI 2.0, Initial Sequence and Parameters are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| <-- CORE_RESET_NTF -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status.
CORE_RESET_NTF payloads are Reset Trigger,
Configuration Status, NCI Version, Manufacturer ID,
Manufacturer Specific Information Length,
Manufacturer Specific Information.
CORE_INIT_CMD payloads are Feature1, Feature2.
CORE_INIT_RSP payloads are Status, NFCC Features,
Max Logical Connections, Max Routing Table Size,
Max Control Packet Payload Size,
Max Data Packet Payload Size of the Static HCI Connection,
Number of Credits of the Static HCI Connection,
Max NFC-V RF Frame Size, Number of Supported RF Interfaces,
Supported RF Interfaces.
Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com>
Link: https://lore.kernel.org/r/20201202223147.3472-1-bongsu.jeon@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-03 07:31:47 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-09-22 10:47:52 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-22 10:47:52 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-22 10:47:52 +03:00
|
|
|
|
2011-12-20 16:57:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-22 10:47:52 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-22 10:47:52 +03:00
|
|
|
|
2011-12-20 16:57:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-22 10:47:52 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-09-22 10:47:52 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-20 16:57:40 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
2011-12-20 16:57:40 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
|
|
|
|
|
2011-12-20 16:57:40 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-22 19:48:38 +02:00
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
2014-07-22 19:48:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:37 +03:00
|
|
|
|
2015-06-06 13:16:41 +02:00
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2015-06-06 13:16:41 +02:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-06-06 13:16:41 +02:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-06-06 13:16:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2015-06-06 13:16:41 +02:00
|
|
|
|
2015-10-22 12:11:37 +03:00
|
|
|
|
2015-06-06 13:16:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-06-06 13:16:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-10-22 12:11:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-20 17:26:01 +02:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-08-20 17:26:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-08-20 17:26:01 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2016-04-30 09:12:52 +02:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2016-04-30 09:12:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:02 +02:00
|
|
|
|
2016-04-30 09:12:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2016-04-30 09:12:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
networking: introduce and use skb_put_data()
A common pattern with skb_put() is to just want to memcpy()
some data into the new space, introduce skb_put_data() for
this.
An spatch similar to the one for skb_put_zero() converts many
of the places using it:
@@
identifier p, p2;
expression len, skb, data;
type t, t2;
@@
(
-p = skb_put(skb, len);
+p = skb_put_data(skb, data, len);
|
-p = (t)skb_put(skb, len);
+p = skb_put_data(skb, data, len);
)
(
p2 = (t2)p;
-memcpy(p2, data, len);
|
-memcpy(p, data, len);
)
@@
type t, t2;
identifier p, p2;
expression skb, data;
@@
t *p;
...
(
-p = skb_put(skb, sizeof(t));
+p = skb_put_data(skb, data, sizeof(t));
|
-p = (t *)skb_put(skb, sizeof(t));
+p = skb_put_data(skb, data, sizeof(t));
)
(
p2 = (t2)p;
-memcpy(p2, data, sizeof(*p));
|
-memcpy(p, data, sizeof(*p));
)
@@
expression skb, len, data;
@@
-memcpy(skb_put(skb, len), data, len);
+skb_put_data(skb, data, len);
(again, manually post-processed to retain some comments)
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 14:29:20 +02:00
|
|
|
|
2016-04-30 09:12:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2016-04-30 09:12:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-16 23:27:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-06 13:16:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-06-06 13:16:40 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2015-06-06 13:16:39 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-06 12:58:17 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
net/nfc/nci: Support NCI 2.x initial sequence
implement the NCI 2.x initial sequence to support NCI 2.x NFCC.
Since NCI 2.0, CORE_RESET and CORE_INIT sequence have been changed.
If NFCEE supports NCI 2.x, then NCI 2.x initial sequence will work.
In NCI 1.0, Initial sequence and payloads are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status, NCI version, Configuration Status.
CORE_INIT_CMD payloads are empty.
CORE_INIT_RSP payloads are Status, NFCC Features,
Number of Supported RF Interfaces, Supported RF Interface,
Max Logical Connections, Max Routing table Size,
Max Control Packet Payload Size, Max Size for Large Parameters,
Manufacturer ID, Manufacturer Specific Information.
In NCI 2.0, Initial Sequence and Parameters are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| <-- CORE_RESET_NTF -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status.
CORE_RESET_NTF payloads are Reset Trigger,
Configuration Status, NCI Version, Manufacturer ID,
Manufacturer Specific Information Length,
Manufacturer Specific Information.
CORE_INIT_CMD payloads are Feature1, Feature2.
CORE_INIT_RSP payloads are Status, NFCC Features,
Max Logical Connections, Max Routing Table Size,
Max Control Packet Payload Size,
Max Data Packet Payload Size of the Static HCI Connection,
Number of Credits of the Static HCI Connection,
Max NFC-V RF Frame Size, Number of Supported RF Interfaces,
Supported RF Interfaces.
Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com>
Link: https://lore.kernel.org/r/20201202223147.3472-1-bongsu.jeon@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-03 07:31:47 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
net/nfc/nci: Support NCI 2.x initial sequence
implement the NCI 2.x initial sequence to support NCI 2.x NFCC.
Since NCI 2.0, CORE_RESET and CORE_INIT sequence have been changed.
If NFCEE supports NCI 2.x, then NCI 2.x initial sequence will work.
In NCI 1.0, Initial sequence and payloads are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status, NCI version, Configuration Status.
CORE_INIT_CMD payloads are empty.
CORE_INIT_RSP payloads are Status, NFCC Features,
Number of Supported RF Interfaces, Supported RF Interface,
Max Logical Connections, Max Routing table Size,
Max Control Packet Payload Size, Max Size for Large Parameters,
Manufacturer ID, Manufacturer Specific Information.
In NCI 2.0, Initial Sequence and Parameters are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| <-- CORE_RESET_NTF -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status.
CORE_RESET_NTF payloads are Reset Trigger,
Configuration Status, NCI Version, Manufacturer ID,
Manufacturer Specific Information Length,
Manufacturer Specific Information.
CORE_INIT_CMD payloads are Feature1, Feature2.
CORE_INIT_RSP payloads are Status, NFCC Features,
Max Logical Connections, Max Routing Table Size,
Max Control Packet Payload Size,
Max Data Packet Payload Size of the Static HCI Connection,
Number of Credits of the Static HCI Connection,
Max NFC-V RF Frame Size, Number of Supported RF Interfaces,
Supported RF Interfaces.
Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com>
Link: https://lore.kernel.org/r/20201202223147.3472-1-bongsu.jeon@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-03 07:31:47 +09:00
|
|
|
|
2021-01-19 05:55:22 +09:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
net/nfc/nci: Support NCI 2.x initial sequence
implement the NCI 2.x initial sequence to support NCI 2.x NFCC.
Since NCI 2.0, CORE_RESET and CORE_INIT sequence have been changed.
If NFCEE supports NCI 2.x, then NCI 2.x initial sequence will work.
In NCI 1.0, Initial sequence and payloads are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status, NCI version, Configuration Status.
CORE_INIT_CMD payloads are empty.
CORE_INIT_RSP payloads are Status, NFCC Features,
Number of Supported RF Interfaces, Supported RF Interface,
Max Logical Connections, Max Routing table Size,
Max Control Packet Payload Size, Max Size for Large Parameters,
Manufacturer ID, Manufacturer Specific Information.
In NCI 2.0, Initial Sequence and Parameters are as below:
(DH) (NFCC)
| -- CORE_RESET_CMD --> |
| <-- CORE_RESET_RSP -- |
| <-- CORE_RESET_NTF -- |
| -- CORE_INIT_CMD --> |
| <-- CORE_INIT_RSP -- |
CORE_RESET_RSP payloads are Status.
CORE_RESET_NTF payloads are Reset Trigger,
Configuration Status, NCI Version, Manufacturer ID,
Manufacturer Specific Information Length,
Manufacturer Specific Information.
CORE_INIT_CMD payloads are Feature1, Feature2.
CORE_INIT_RSP payloads are Status, NFCC Features,
Max Logical Connections, Max Routing Table Size,
Max Control Packet Payload Size,
Max Data Packet Payload Size of the Static HCI Connection,
Number of Credits of the Static HCI Connection,
Max NFC-V RF Frame Size, Number of Supported RF Interfaces,
Supported RF Interfaces.
Signed-off-by: Bongsu Jeon <bongsu.jeon@samsung.com>
Link: https://lore.kernel.org/r/20201202223147.3472-1-bongsu.jeon@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2020-12-03 07:31:47 +09:00
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:36 +03:00
|
|
|
|
2015-08-20 17:26:00 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2012-01-18 13:16:12 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-16 21:02:49 +08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-11-16 23:27:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-13 00:04:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-04-05 10:17:26 +02:00
|
|
|
|
|
|
|
|
|
2026-03-03 08:23:43 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-17 12:33:34 -07:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2015-06-06 13:16:48 +02:00
|
|
|
|
|
|
|
|
|
2026-03-17 12:33:34 -07:00
|
|
|
|
2015-06-06 13:16:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2026-03-17 12:33:34 -07:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2025-04-05 10:17:26 +02:00
|
|
|
|
2026-03-03 08:23:43 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-12-31 11:59:26 +09:00
|
|
|
|
2021-11-16 23:27:32 +08:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-17 12:33:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 14:43:17 -07:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2025-05-09 07:51:14 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-17 12:03:50 +02:00
|
|
|
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 14:43:17 -07:00
|
|
|
|
2012-01-17 12:03:50 +02:00
|
|
|
|
2025-05-09 07:51:14 +02:00
|
|
|
|
2012-01-17 12:03:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2014-01-06 12:58:18 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2014-01-06 12:58:18 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:10 +01:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:11 +01:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-10-03 05:02:28 +02:00
|
|
|
|
2015-02-01 22:26:11 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
2015-02-03 19:48:05 +01:00
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
|
|
|
|
|
2015-02-03 19:48:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
2015-02-03 19:48:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:40 +03:00
|
|
|
|
2016-04-30 09:12:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:49 +02:00
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
2016-04-30 09:12:49 +02:00
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
2016-04-30 09:12:49 +02:00
|
|
|
|
2016-04-30 09:12:51 +02:00
|
|
|
|
2015-02-03 19:48:05 +01:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-03 19:48:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
|
|
|
|
|
2016-04-30 09:12:50 +02:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2015-10-03 05:02:28 +02:00
|
|
|
|
2015-02-01 22:26:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-03 13:45:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:47 +02:00
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-04 15:15:46 +02:00
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
2012-10-04 15:15:45 +02:00
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2014-10-21 16:52:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-10-04 15:15:46 +02:00
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-15 15:57:06 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-22 11:13:01 +03:00
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-22 11:13:01 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2014-12-02 21:27:49 +01:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:47 +02:00
|
|
|
|
2012-08-15 11:46:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:44 +02:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-05-15 15:57:06 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2021-07-30 16:42:01 +02:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-10-09 16:00:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-04 00:14:04 +02:00
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
2024-11-03 13:45:25 +01:00
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
2024-11-03 13:45:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:14 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
2015-10-25 22:54:43 +01:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-25 22:54:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-18 13:16:12 +02:00
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 11:46:24 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-25 22:54:43 +01:00
|
|
|
|
2014-10-21 16:52:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-31 12:21:44 +02:00
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 11:46:24 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-16 15:55:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-09-22 11:36:19 +03:00
|
|
|
|
2021-07-30 16:42:02 +02:00
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
2015-02-03 19:48:04 +01:00
|
|
|
|
2026-03-03 08:23:41 -08:00
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
2026-03-03 08:23:41 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-05-07 12:31:13 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2026-03-03 08:23:41 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-03 08:23:41 -08:00
|
|
|
|
|
|
|
|
|
2011-09-22 11:36:19 +03:00
|
|
|
|
2026-03-03 08:23:41 -08:00
|
|
|
|
2011-09-22 11:36:19 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-09 12:09:14 +02:00
|
|
|
|
2011-09-22 11:36:19 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2014-10-21 16:52:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-10 11:57:06 +02:00
|
|
|
|
|
|
|
|
|
2014-11-13 00:30:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-10 11:57:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-13 00:30:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-10 11:57:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-03 19:48:08 +01:00
|
|
|
|
2014-11-13 00:30:35 +01:00
|
|
|
|
|
|
|
|
|
2015-02-03 19:48:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-13 00:30:35 +01:00
|
|
|
|
2015-02-03 19:48:08 +01:00
|
|
|
|
2014-11-13 00:30:35 +01:00
|
|
|
|
2013-05-10 11:57:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-13 00:30:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-09 11:12:03 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-24 23:49:25 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-15 11:46:24 +03:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-05-16 15:55:48 +02:00
|
|
|
|
2014-10-21 16:52:48 +02:00
|
|
|
|
2013-05-10 11:57:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-13 00:30:38 +01:00
|
|
|
|
2015-03-09 11:12:03 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-28 01:56:53 +01:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2021-07-24 23:47:33 +02:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-09-23 09:14:35 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-29 11:37:35 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-09-23 09:14:35 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-09-23 09:14:35 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2026-02-21 16:37:42 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-09-23 09:14:35 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-24 23:47:33 +02:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2014-02-13 13:25:48 +08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2015-02-01 22:26:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-23 09:14:35 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2015-02-01 22:26:14 +01:00
|
|
|
|
2017-03-30 12:15:35 +02:00
|
|
|
|
2015-02-01 22:26:14 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-09-23 09:14:35 +03:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-15 07:29:06 +08:00
|
|
|
|
2024-01-25 12:53:09 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-13 01:15:08 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-22 19:48:39 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
treewide: setup_timer() -> timer_setup()
This converts all remaining cases of the old setup_timer() API into using
timer_setup(), where the callback argument is the structure already
holding the struct timer_list. These should have no behavioral changes,
since they just change which pointer is passed into the callback with
the same available pointers after conversion. It handles the following
examples, in addition to some other variations.
Casting from unsigned long:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
setup_timer(&ptr->my_timer, my_callback, ptr);
and forced object casts:
void my_callback(struct something *ptr)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
become:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
Direct function assignments:
void my_callback(unsigned long data)
{
struct something *ptr = (struct something *)data;
...
}
...
ptr->my_timer.function = my_callback;
have a temporary cast added, along with converting the args:
void my_callback(struct timer_list *t)
{
struct something *ptr = from_timer(ptr, t, my_timer);
...
}
...
ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
And finally, callbacks without a data assignment:
void my_callback(unsigned long data)
{
...
}
...
setup_timer(&ptr->my_timer, my_callback, 0);
have their argument renamed to verify they're unused during conversion:
void my_callback(struct timer_list *unused)
{
...
}
...
timer_setup(&ptr->my_timer, my_callback, 0);
The conversion is done with the following Coccinelle script:
spatch --very-quiet --all-includes --include-headers \
-I ./arch/x86/include -I ./arch/x86/include/generated \
-I ./include -I ./arch/x86/include/uapi \
-I ./arch/x86/include/generated/uapi -I ./include/uapi \
-I ./include/generated/uapi --include ./include/linux/kconfig.h \
--dir . \
--cocci-file ~/src/data/timer_setup.cocci
@fix_address_of@
expression e;
@@
setup_timer(
-&(e)
+&e
, ...)
// Update any raw setup_timer() usages that have a NULL callback, but
// would otherwise match change_timer_function_usage, since the latter
// will update all function assignments done in the face of a NULL
// function initialization in setup_timer().
@change_timer_function_usage_NULL@
expression _E;
identifier _timer;
type _cast_data;
@@
(
-setup_timer(&_E->_timer, NULL, _E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E->_timer, NULL, (_cast_data)_E);
+timer_setup(&_E->_timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, &_E);
+timer_setup(&_E._timer, NULL, 0);
|
-setup_timer(&_E._timer, NULL, (_cast_data)&_E);
+timer_setup(&_E._timer, NULL, 0);
)
@change_timer_function_usage@
expression _E;
identifier _timer;
struct timer_list _stl;
identifier _callback;
type _cast_func, _cast_data;
@@
(
-setup_timer(&_E->_timer, _callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
+timer_setup(&_E._timer, _callback, 0);
|
_E->_timer@_stl.function = _callback;
|
_E->_timer@_stl.function = &_callback;
|
_E->_timer@_stl.function = (_cast_func)_callback;
|
_E->_timer@_stl.function = (_cast_func)&_callback;
|
_E._timer@_stl.function = _callback;
|
_E._timer@_stl.function = &_callback;
|
_E._timer@_stl.function = (_cast_func)_callback;
|
_E._timer@_stl.function = (_cast_func)&_callback;
)
// callback(unsigned long arg)
@change_callback_handle_cast
depends on change_timer_function_usage@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
identifier _handle;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
(
... when != _origarg
_handletype *_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(_handletype *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
|
... when != _origarg
_handletype *_handle;
... when != _handle
_handle =
-(void *)_origarg;
+from_timer(_handle, t, _timer);
... when != _origarg
)
}
// callback(unsigned long arg) without existing variable
@change_callback_handle_cast_no_arg
depends on change_timer_function_usage &&
!change_callback_handle_cast@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _origtype;
identifier _origarg;
type _handletype;
@@
void _callback(
-_origtype _origarg
+struct timer_list *t
)
{
+ _handletype *_origarg = from_timer(_origarg, t, _timer);
+
... when != _origarg
- (_handletype *)_origarg
+ _origarg
... when != _origarg
}
// Avoid already converted callbacks.
@match_callback_converted
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier t;
@@
void _callback(struct timer_list *t)
{ ... }
// callback(struct something *handle)
@change_callback_handle_arg
depends on change_timer_function_usage &&
!match_callback_converted &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
@@
void _callback(
-_handletype *_handle
+struct timer_list *t
)
{
+ _handletype *_handle = from_timer(_handle, t, _timer);
...
}
// If change_callback_handle_arg ran on an empty function, remove
// the added handler.
@unchange_callback_handle_arg
depends on change_timer_function_usage &&
change_callback_handle_arg@
identifier change_timer_function_usage._callback;
identifier change_timer_function_usage._timer;
type _handletype;
identifier _handle;
identifier t;
@@
void _callback(struct timer_list *t)
{
- _handletype *_handle = from_timer(_handle, t, _timer);
}
// We only want to refactor the setup_timer() data argument if we've found
// the matching callback. This undoes changes in change_timer_function_usage.
@unchange_timer_function_usage
depends on change_timer_function_usage &&
!change_callback_handle_cast &&
!change_callback_handle_cast_no_arg &&
!change_callback_handle_arg@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type change_timer_function_usage._cast_data;
@@
(
-timer_setup(&_E->_timer, _callback, 0);
+setup_timer(&_E->_timer, _callback, (_cast_data)_E);
|
-timer_setup(&_E._timer, _callback, 0);
+setup_timer(&_E._timer, _callback, (_cast_data)&_E);
)
// If we fixed a callback from a .function assignment, fix the
// assignment cast now.
@change_timer_function_assignment
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression change_timer_function_usage._E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_func;
typedef TIMER_FUNC_TYPE;
@@
(
_E->_timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E->_timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-&_callback;
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)_callback
+(TIMER_FUNC_TYPE)_callback
;
|
_E._timer.function =
-(_cast_func)&_callback
+(TIMER_FUNC_TYPE)_callback
;
)
// Sometimes timer functions are called directly. Replace matched args.
@change_timer_function_calls
depends on change_timer_function_usage &&
(change_callback_handle_cast ||
change_callback_handle_cast_no_arg ||
change_callback_handle_arg)@
expression _E;
identifier change_timer_function_usage._timer;
identifier change_timer_function_usage._callback;
type _cast_data;
@@
_callback(
(
-(_cast_data)_E
+&_E->_timer
|
-(_cast_data)&_E
+&_E._timer
|
-_E
+&_E->_timer
)
)
// If a timer has been configured without a data argument, it can be
// converted without regard to the callback argument, since it is unused.
@match_timer_function_unused_data@
expression _E;
identifier _timer;
identifier _callback;
@@
(
-setup_timer(&_E->_timer, _callback, 0);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0L);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E->_timer, _callback, 0UL);
+timer_setup(&_E->_timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0L);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_E._timer, _callback, 0UL);
+timer_setup(&_E._timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0L);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(&_timer, _callback, 0UL);
+timer_setup(&_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0L);
+timer_setup(_timer, _callback, 0);
|
-setup_timer(_timer, _callback, 0UL);
+timer_setup(_timer, _callback, 0);
)
@change_callback_unused_data
depends on match_timer_function_unused_data@
identifier match_timer_function_unused_data._callback;
type _origtype;
identifier _origarg;
@@
void _callback(
-_origtype _origarg
+struct timer_list *unused
)
{
... when != _origarg
}
Signed-off-by: Kees Cook <keescook@chromium.org>
2017-10-16 14:43:17 -07:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2014-07-22 19:48:39 +02:00
|
|
|
|
|
|
|
|
|
2020-07-17 15:10:16 +08:00
|
|
|
|
2014-07-22 19:48:39 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2020-07-17 15:10:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-07-13 01:15:08 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:02 +02:00
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
2026-01-27 04:03:59 +00:00
|
|
|
|
|
|
|
|
|
2021-11-16 23:27:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-27 04:03:59 +00:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-22 11:36:17 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2013-05-22 11:36:17 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-29 11:37:35 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2012-10-04 15:15:51 +02:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 10:27:38 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-29 11:37:35 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-05-05 19:52:27 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-22 11:36:17 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2015-10-26 10:27:38 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2021-07-24 23:47:32 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:35 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
networking: make skb_put & friends return void pointers
It seems like a historic accident that these return unsigned char *,
and in many places that means casts are required, more often than not.
Make these functions (skb_put, __skb_put and pskb_put) return void *
and remove all the casts across the tree, adding a (u8 *) cast only
where the unsigned char pointer was used directly, all done with the
following spatch:
@@
expression SKB, LEN;
typedef u8;
identifier fn = { skb_put, __skb_put };
@@
- *(fn(SKB, LEN))
+ *(u8 *)fn(SKB, LEN)
@@
expression E, SKB, LEN;
identifier fn = { skb_put, __skb_put };
type T;
@@
- E = ((T *)(fn(SKB, LEN)))
+ E = fn(SKB, LEN)
which actually doesn't cover pskb_put since there are only three
users overall.
A handful of stragglers were converted manually, notably a macro in
drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many
instances in net/bluetooth/hci_sock.c. In the former file, I also
had to fix one whitespace problem spatch introduced.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 14:29:21 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
networking: introduce and use skb_put_data()
A common pattern with skb_put() is to just want to memcpy()
some data into the new space, introduce skb_put_data() for
this.
An spatch similar to the one for skb_put_zero() converts many
of the places using it:
@@
identifier p, p2;
expression len, skb, data;
type t, t2;
@@
(
-p = skb_put(skb, len);
+p = skb_put_data(skb, data, len);
|
-p = (t)skb_put(skb, len);
+p = skb_put_data(skb, data, len);
)
(
p2 = (t2)p;
-memcpy(p2, data, len);
|
-memcpy(p, data, len);
)
@@
type t, t2;
identifier p, p2;
expression skb, data;
@@
t *p;
...
(
-p = skb_put(skb, sizeof(t));
+p = skb_put_data(skb, data, sizeof(t));
|
-p = (t *)skb_put(skb, sizeof(t));
+p = skb_put_data(skb, data, sizeof(t));
)
(
p2 = (t2)p;
-memcpy(p2, data, sizeof(*p));
|
-memcpy(p, data, sizeof(*p));
)
@@
expression skb, len, data;
@@
-memcpy(skb_put(skb, len), data, len);
+skb_put_data(skb, data, len);
(again, manually post-processed to retain some comments)
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 14:29:20 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 10:27:38 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
2021-07-24 23:47:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
2021-07-24 23:47:35 +02:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
2021-07-24 23:47:35 +02:00
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
2021-07-24 23:47:35 +02:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
2021-07-24 23:47:35 +02:00
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
2021-07-24 23:47:35 +02:00
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 13:58:54 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 13:58:54 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 13:58:54 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-10-26 13:58:54 +02:00
|
|
|
|
|
|
|
|
|
2015-10-22 12:11:38 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-06-06 13:16:37 +02:00
|
|
|
|
|
|
|
|
|
2024-05-19 18:43:03 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-02 18:32:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-19 18:43:03 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 16:42:02 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-30 16:03:37 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-09 12:09:16 +02:00
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2011-11-29 11:37:33 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2013-05-22 11:36:17 +02:00
|
|
|
|
2012-01-17 12:03:50 +02:00
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2022-10-30 16:03:37 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-30 16:03:37 +01:00
|
|
|
|
|
|
|
|
|
2014-05-05 19:52:27 +09:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-05-19 18:43:03 +09:00
|
|
|
|
2024-03-20 09:54:10 +09:00
|
|
|
|
2024-05-22 00:34:42 +09:00
|
|
|
|
2024-03-20 09:54:10 +09:00
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:32 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-17 12:03:50 +02:00
|
|
|
|
2021-04-05 18:54:35 +08:00
|
|
|
|
2012-01-17 12:03:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-02-01 22:26:08 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-17 12:03:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:35 -08:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-30 16:03:37 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2011-11-29 11:37:33 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
2013-05-22 11:36:17 +02:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-03-05 01:03:54 +01:00
|
|
|
|
2022-10-30 16:03:37 +01:00
|
|
|
|
2011-09-18 11:19:35 +03:00
|
|
|
|
|
|
|
|
|
2012-07-12 19:17:34 +02:00
|
|
|
|
2024-01-08 10:16:04 -08:00
|
|
|
|
2012-07-12 19:17:34 +02:00
|
|
|
|