| /linux/drivers/android/binder/ |
| H A D | page_range.rs | 49 // SAFETY: The shrinker and list_lru are thread safe. 51 // SAFETY: The shrinker and list_lru are thread safe. 57 /// # Safety 70 // SAFETY: These fields are not yet used, so it's okay to zero them. in register() 76 // SAFETY: The field is not yet used, so we can initialize it. in register() 82 // SAFETY: The `name` points at a valid c string. in register() 85 // SAFETY: We initialized it, so its okay to destroy it. in register() 90 // SAFETY: We're about to register the shrinker, and these are the fields we need to in register() 98 // SAFETY: The new shrinker has been fully initialized, so we can register it. in register() 101 // SAFETY: This initializes the pointer to the shrinker so that we can use it. in register() [all …]
|
| H A D | rust_binder_main.rs | 288 // SAFETY: We call register in `init`. 295 // SAFETY: The module initializer never runs twice, so we only call this once. in init() 300 // SAFETY: The module is being loaded, so we can initialize binderfs. in init() 310 // SAFETY: Used only to insert C bindings types into globals, which is safe. 317 // SAFETY: All zeroes is safe for the `file_operations` type. 334 /// # Safety 340 // SAFETY: The caller will always provide a valid c string here. in rust_binder_new_context() 348 /// # Safety 353 // SAFETY: The caller ensures that the `device` pointer came from a previous call to in rust_binder_remove_context() 361 /// # Safety [all …]
|
| H A D | trace.rs | 42 // SAFETY: Always safe to call. in trace_ioctl() 48 // SAFETY: Always safe to call. in trace_ioctl_done() 53 // SAFETY: Always safe to call. in trace_read_done() 58 // SAFETY: Always safe to call. in trace_write_done() 64 // SAFETY: Always safe to call. in trace_wait_for_work() 74 // SAFETY: The raw transaction is valid for the duration of this call. The thread pointer is in trace_transaction() 81 // SAFETY: The raw transaction is valid for the duration of this call. in trace_transaction_received() 87 // SAFETY: This function is always safe to call. in trace_transaction_fd_send() 92 // SAFETY: This function is always safe to call. in trace_transaction_fd_recv() 98 // SAFETY: This function is always safe to call. in trace_command() [all …]
|
| /linux/rust/kernel/ |
| H A D | opp.rs | 43 // SAFETY: The requirements are satisfied by the existence of [`Device`] and its safety in new() 58 // SAFETY: The `ptr` is guaranteed by the C code to be valid. in table() 74 // SAFETY: The pointer was created via `dev_pm_opp_init_cpufreq_table`, and is only in drop() 183 // SAFETY: The requirements are satisfied by the existence of [`Device`] and its safety in new() 195 // SAFETY: The requirements are satisfied by the existence of [`Device`] and its safety in drop() 321 // SAFETY: This is the same token value returned by the C code via `dev_pm_opp_set_config`. in drop() 493 // SAFETY: The requirements are satisfied by the existence of [`Device`] and its safety in set() 514 /// SAFETY: Called from C. Inputs must be valid pointers. 523 // SAFETY: 'dev' is guaranteed by the C code to be valid. in config_clks() 527 // SAFETY: 'opp_table' is guaranteed by the C code to be valid. in config_clks() [all …]
|
| H A D | auxiliary.rs | 37 // SAFETY: 48 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 56 // SAFETY: It's safe to set the fields of `struct auxiliary_driver` on initialization. in register() 64 // SAFETY: `adrv` is guaranteed to be a valid `DriverType`. in register() 71 // SAFETY: `adrv` is guaranteed to be a valid `DriverType`. in unregister() 81 // SAFETY: The auxiliary bus only ever calls the probe callback with a valid pointer to a in probe_callback() 87 // SAFETY: `DeviceId` is a `#[repr(transparent)`] wrapper of `struct auxiliary_device_id` in probe_callback() 101 // SAFETY: The auxiliary bus only ever calls the probe callback with a valid pointer to a in remove_callback() 107 // SAFETY: `remove_callback` is only ever called after a successful call to in remove_callback() 156 // SAFETY: `DeviceId` is a `#[repr(transparent)]` wrapper of `auxiliary_device_id` and does not add [all …]
|
| H A D | usb.rs | 37 // SAFETY: 48 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 56 // SAFETY: It's safe to set the fields of `struct usb_driver` on initialization. in register() 64 // SAFETY: `udrv` is guaranteed to be a valid `DriverType`. in register() 71 // SAFETY: `udrv` is guaranteed to be a valid `DriverType`. 81 // SAFETY: The USB core only ever calls the probe callback with a valid pointer to a in probe_callback() 88 // SAFETY: `DeviceId` is a `#[repr(transparent)]` wrapper of `struct usb_device_id` and in probe_callback() 102 // SAFETY: The USB core only ever calls the disconnect callback with a valid pointer to a 110 // SAFETY: `disconnect_callback` is only ever called after a successful call to in disconnect_callback() 133 // SAFETY in from_id() [all...] |
| H A D | configfs.rs | 135 // SAFETY: We do not provide any operations on `Subsystem`. 138 // SAFETY: Ownership of `Subsystem` can safely be transferred to other threads. 155 // SAFETY: We initialized the required fields of `place.group` above. in new() 164 // SAFETY: `place.su_mutex` is valid for use as a mutex. in new() 179 // SAFETY: We initialized `this.subsystem` according to C API contract above. in new() 189 // SAFETY: We registered `self.subsystem` in the initializer returned by `Self::new`. in drop() 191 // SAFETY: We initialized the mutex in `Subsystem::new`. in drop() 201 /// # Safety 208 /// # Safety 215 /// # Safety [all...] |
| H A D | mm.rs | 52 // SAFETY: It is safe to call `mmdrop` on another thread than where `mmgrab` was called. 54 // SAFETY: All methods on `Mm` can be called in parallel from several threads. 57 // SAFETY: By the type invariants, this type is always refcounted. 61 // SAFETY: The pointer is valid since self is a reference. in inc_ref() 67 // SAFETY: The caller is giving up their refcount. in dec_ref() 88 // SAFETY: It is safe to call `mmput` on another thread than where `mmget` was called. 90 // SAFETY: All methods on `MmWithUser` can be called in parallel from several threads. 93 // SAFETY: By the type invariants, this type is always refcounted. 97 // SAFETY: The pointer is valid since self is a reference. in inc_ref() 103 // SAFETY: The caller is giving up their refcount. in dec_ref() [all …]
|
| H A D | cpufreq.rs | 135 /// # Safety 141 // SAFETY: Guaranteed by the safety requirements of the function. in from_raw_mut() 158 // SAFETY: By the type invariant, the pointer stored in `self` is valid. in generic_verify() 176 /// # Safety 214 /// // SAFETY: Index is a valid entry in the table. 229 /// # Safety 235 // SAFETY: Guaranteed by the safety requirements of the function. in from_raw() 252 // SAFETY: By the type invariant, the pointer stored in `self` is valid and `index` is in freq() 253 // guaranteed to be valid by its safety requirements. in freq() 262 // SAFETY: By the type invariant, the pointer stored in `self` is valid and `index` is in flags() [all …]
|
| H A D | scatterlist.rs | 56 // SAFETY: `SGEntry` can be sent to any task. 59 // SAFETY: `SGEntry` has no interior mutability and can be accessed concurrently. 65 /// # Safety 71 // SAFETY: The safety requirements of this function guarantee that `ptr` is a valid pointer in from_raw() 87 // SAFETY: `self.as_raw()` is a valid pointer to a `struct scatterlist`. in dma_address() 95 // SAFETY: `self.as_raw()` is a valid pointer to a `struct scatterlist`. in dma_len() 105 // SAFETY: `Borrowed` can be sent to any task. 108 // SAFETY: `Borrowed` has no interior mutability and can be accessed concurrently. 138 /// # Safety [all...] |
| H A D | i2c.rs | 59 // SAFETY: `DeviceId` is a `#[repr(transparent)]` wrapper of `i2c_device_id` and does not add 65 // SAFETY: `DRIVER_DATA_OFFSET` is the offset to the `driver_data` field. 94 // SAFETY: 105 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 133 // SAFETY: It's safe to set the fields of `struct i2c_client` on initialization. in register() 144 // SAFETY: `idrv` is guaranteed to be a valid `DriverType`. in register() 149 // SAFETY: `idrv` is guaranteed to be a valid `DriverType`. in unregister() 156 // SAFETY: The I2C bus only ever calls the probe callback with a valid pointer to a in probe_callback() 174 // SAFETY: `idev` is a valid pointer to a `struct i2c_client`. in remove_callback() 177 // SAFETY in remove_callback() [all...] |
| H A D | pci.rs | 60 // SAFETY: 71 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 79 // SAFETY: It's safe to set the fields of `struct pci_driver` on initialization. in register() 87 // SAFETY: `pdrv` is guaranteed to be a valid `DriverType`. in register() 94 // SAFETY: `pdrv` is guaranteed to be a valid `DriverType`. in unregister() 104 // SAFETY: The PCI bus only ever calls the probe callback with a valid pointer to a in probe_callback() 110 // SAFETY: `DeviceId` is a `#[repr(transparent)]` wrapper of `struct pci_device_id` and in probe_callback() 124 // SAFETY: The PCI bus only ever calls the remove callback with a valid pointer to a in remove_callback() 130 // SAFETY: `remove_callback` is only ever called after a successful call to in remove_callback() 227 // SAFETY: `DeviceId` is a `#[repr(transparent)]` wrapper of `pci_device_id` and does not add [all …]
|
| H A D | platform.rs | 46 // SAFETY: 57 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 75 // SAFETY: It's safe to set the fields of `struct platform_driver` on initialization. in register() 84 // SAFETY: `pdrv` is guaranteed to be a valid `DriverType`. in register() 89 // SAFETY: `pdrv` is guaranteed to be a valid `DriverType`. in unregister() 96 // SAFETY: The platform bus only ever calls the probe callback with a valid pointer to a in probe_callback() 112 // SAFETY: The platform bus only ever calls the remove callback with a valid pointer to a in remove_callback() 118 // SAFETY: `remove_callback` is only ever called after a successful call to in remove_callback() 268 // SAFETY: `self.as_raw()` returns a valid pointer to a `struct platform_device`. in resource_by_index() 277 // SAFETY: `resource` is a valid pointer to a `struct resource` as in resource_by_index() [all …]
|
| H A D | task.rs | 37 // SAFETY: This expression creates a temporary value that is dropped at the end of the 43 // `begin_new_exec()` is responsible for safety. 98 // SAFETY: By design, the only way to access a `Task` is via the `current` function or via an 104 // SAFETY: It's OK to access `Task` through shared references from other threads because we're 162 // SAFETY: Getting the current pointer is always safe. in current_raw() 171 /// # Safety 186 // SAFETY: The returned reference borrows from this `TaskRef`, so it cannot outlive in current() 208 // SAFETY: The pid of a task never changes after initialization, so reading this field is in pid() 216 // SAFETY: It's always safe to call `task_uid` on a valid task. in uid() 223 // SAFETY: It's always safe to call `task_euid` on a valid task. in euid() [all …]
|
| H A D | device.rs | 96 /// // SAFETY: `Device` is a transparent wrapper of a type that doesn't depend on `Device`'s 175 /// # Safety 184 // SAFETY: By the safety requirements ptr is valid in get_device() 190 /// # Safety 197 // CAST: By the safety requirements the caller is responsible to guarantee that the in as_bound() 201 // SAFETY: in as_bound() 210 // SAFETY: By the type invariants, `self.as_raw()` is a valid pointer to a `struct device`. in set_type_id() 213 // SAFETY: For a bound device (implied by the `CoreInternal` device context), `private` is in set_type_id() 217 // SAFETY in set_type_id() [all...] |
| H A D | rbtree.rs | 176 // SAFETY: An [`RBTree`] allows the same kinds of access to its values that a struct allows to its 180 // SAFETY: An [`RBTree`] allows the same kinds of access to its values that a struct allows to its 208 // SAFETY: by the invariants, all pointers are valid. in iter() 223 // SAFETY: by the invariants, all pointers are valid. in iter_mut() 248 // SAFETY: `self.root` is always a valid root node. in cursor_front_mut() 263 // SAFETY: `self.root` is always a valid root node. in cursor_front() 278 // SAFETY: `self.root` is always a valid root node. in cursor_back_mut() 293 // SAFETY: `self.root` is always a valid root node. in cursor_back() 363 // SAFETY: `raw_self` is a valid pointer to the `RBTree` (created from `self` above). in raw_entry() 367 // SAFETY in raw_entry() [all...] |
| /linux/rust/kernel/drm/ |
| H A D | device.rs | 129 // SAFETY: in new() 143 // SAFETY: `raw_drm` is a valid pointer to `Self`, given that `__drm_dev_alloc` was in new() 147 // SAFETY: `raw_drm` is a valid pointer to `Self`. in new() 150 // SAFETY: in new() 154 // SAFETY: `__drm_dev_alloc()` was successful, hence `drm_dev` must be valid and the in new() 159 // SAFETY: `drm_dev` is still private to this function. in new() 162 // SAFETY: The reference count is one, and now we take ownership of that reference as a in new() 171 /// # Safety 175 // SAFETY: By the safety requirements of this function `ptr` is a valid pointer to a in from_drm_device() 180 /// # Safety [all …]
|
| /linux/rust/kernel/debugfs/ |
| H A D | file_ops.rs | 40 /// # Safety in new() 62 // SAFETY: `Adapter` asserts that `T` can be legally cast to `T::Inner`. in deref() 86 /// # Safety in writer_open() 95 // SAFETY: The caller ensures that `inode` is a valid pointer. in writer_open() 97 // SAFETY: 100 // so we meet its safety requirements. 108 /// # Safety in writer_act() 116 // SAFETY: By caller precondition, this pointer is valid pointer to a `T`, and 119 // SAFETY: By caller precondition, `seq_file` points to a live `seq_file`, so we can lift 140 // SAFETY [all...] |
| /linux/rust/kernel/drm/gem/ |
| H A D | mod.rs | 44 // SAFETY: All GEM objects are refcounted. 51 // SAFETY: The existence of a shared reference guarantees that the refcount is 57 // SAFETY: `obj` is a valid pointer to an `Object<T>`. 60 // SAFETY: The safety requirements guarantee that the refcount is non-zero. 108 /// # Safety 120 // SAFETY: `open_callback` is only ever called with a valid pointer to a `struct drm_file`. in open_callback() 123 // SAFETY: `open_callback` is specified in the AllocOps structure for `DriverObject<T>`, in open_callback() 137 // SAFETY: `open_callback` is only ever called with a valid pointer to a `struct drm_file`. in close_callback() 140 // SAFETY: `close_callback` is specified in the AllocOps structure for `Object<T>`, ensuring in close_callback() 153 // SAFETY: `obj` is guaranteed to be in an `Object<T>` via the safety contract of this in from_raw() [all …]
|
| H A D | shmem.rs | 72 // SAFETY: All GEM objects are thread-safe. 75 // SAFETY: All GEM objects are thread-safe. 95 // SAFETY: `drm_gem_shmem_vm_ops` is a valid, static const on the C side. 123 // SAFETY: `obj.as_raw()` is guaranteed to be valid by the initialization above. in new() 126 // SAFETY: The arguments are all valid via the type invariants. in new() 129 // SAFETY: We never move out of `self`. in new() 132 // SAFETY: We're taking over the owned refcount from `drm_gem_shmem_init`. in new() 137 // SAFETY: We have yet to expose the new gem object outside of this function, so it is in new() 142 // SAFETY: We have yet to expose this object outside of this function, so we're guaranteed in new() 152 // SAFETY: `dev` will have been initialized in `Self::new()` by `drm_gem_shmem_init()`. in dev() [all …]
|
| /linux/rust/kernel/sync/ |
| H A D | lock.rs | 27 /// # Safety 49 /// # Safety 61 /// # Safety 69 /// # Safety 76 /// # Safety 83 /// # Safety 88 // SAFETY: The safety requirements ensure that the lock is initialised. in relock() 94 /// # Safety 122 // SAFETY [all...] |
| /linux/rust/kernel/alloc/ |
| H A D | kbox.rs | 119 // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee: 123 // SAFETY: `Box` is `Send` if `T` is `Send` because the `Box` owns a `T`. 131 // SAFETY: `Box` is `Sync` if `T` is `Sync` because the `Box` owns a `T`. 146 /// # Safety 155 // INVARIANT: Validity of `raw` is guaranteed by the safety preconditions of this function. 156 // SAFETY: By the safety preconditions of this function, `raw` is not a NULL pointer. 171 /// // SAFETY: `ptr` comes from a previous call to `KBox::into_raw`. 187 // SAFETY: `Box::into_raw` always returns a properly aligned and dereferenceable pointer 202 /// # Safety [all...] |
| H A D | allocator.rs | 74 /// # Safety 76 /// This method has the same safety requirements as [`Allocator::realloc`]. 104 // SAFETY: in call() 107 // - `ptr` is either NULL or valid by the safety requirements of this function. in call() 138 // SAFETY: `realloc` delegates to `ReallocFunc::call`, which guarantees that 155 // SAFETY: `ReallocFunc::call` has the same safety requirements as `Allocator::realloc`. in realloc() 173 /// // SAFETY: By the type invariant of `Box` the inner pointer of `vbox` is non-null. 176 /// // SAFETY: 181 /// // SAFETY: There is no concurrent read or write to the same page. 187 /// # Safety [all …]
|
| /linux/rust/pin-init/src/ |
| H A D | __internal.rs | 21 /// It is unsafe to create this type, since the closure needs to fulfill the same safety 25 // SAFETY: While constructing the `InitClosure`, the user promised that it upholds the 37 // SAFETY: While constructing the `InitClosure`, the user promised that it upholds the 58 /// # Safety 70 /// # Safety 82 /// # Safety 101 /// # Safety 113 /// # Safety 139 // SAFETY: TODO. 144 // SAFETY: TODO. [all …]
|
| /linux/rust/kernel/list/ |
| H A D | impl_list_item_mod.rs | 13 /// # Safety 22 /// # Safety 39 // SAFETY: The implementation of `raw_get_list_links` only compiles if the field has the 50 // SAFETY: The caller promises that the pointer is not dangling. We know that this 63 /// # Safety 85 // SAFETY: The implementation of `raw_get_list_links` only compiles if the field has the 89 // SAFETY: TODO. 94 // SAFETY: The caller promises that the pointer is not dangling. 197 // SAFETY: See GUARANTEES comment on each method. 205 // SAFETY [all...] |