| /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 in set() [all...] |
| H A D | auxiliary.rs | 44 // SAFETY: 55 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if in register() 63 // SAFETY: It's safe to set the fields of `struct auxiliary_driver` on initialization. in register() 71 // SAFETY: `adrv` is guaranteed to be a valid `DriverType`. in unregister() 78 // SAFETY: `adrv` is guaranteed to be a valid `DriverType`. in probe_callback() 88 // SAFETY: The auxiliary bus only ever calls the probe callback with a valid pointer to a in probe_callback() 94 // SAFETY: `DeviceId` is a `#[repr(transparent)`] wrapper of `struct auxiliary_device_id` in probe_callback() 98 // SAFETY: `id` comes from `T::ID_TABLE` which is of type `IdArray<_, T::IdInfo>`. in probe_callback() 110 // SAFETY: The auxiliary bus only ever calls the probe callback with a valid pointer to a in remove_callback() 116 // SAFETY [all...] |
| H A D | usb.rs | 34 // SAFETY: 45 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 53 // SAFETY: It's safe to set the fields of `struct usb_driver` on initialization. in register() 61 // SAFETY: `udrv` is guaranteed to be a valid `DriverType`. in register() 68 // SAFETY: `udrv` is guaranteed to be a valid `DriverType`. in register() 78 // SAFETY: The USB core only ever calls the probe callback with a valid pointer to a 85 // SAFETY: `DeviceId` is a `#[repr(transparent)]` wrapper of `struct usb_device_id` and in probe_callback() 89 // SAFETY: `id` comes from `T::ID_TABLE` which is of type `IdArray<_, T::IdInfo>`. It in probe_callback() 102 // SAFETY: The USB core only ever calls the disconnect callback with a valid pointer to a 110 // SAFETY in disconnect_callback() [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 in freq() [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() 91 // SAFETY: `pdrv` is guaranteed to be a valid `DriverType`. in unregister() 98 // SAFETY: The platform bus only ever calls the probe callback with a valid pointer to a in probe_callback() 103 // SAFETY: `pdev` matched data is of type `Self::IdInfo`. in probe_callback() 115 // SAFETY: The platform bus only ever calls the remove callback with a valid pointer to a in remove_callback() 121 // SAFETY: `remove_callback` is only ever called after a successful call to in remove_callback() 273 // SAFETY: `self.as_raw()` returns a valid pointer to a `struct platform_device`. in resource_by_index() [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 | pci.rs | 62 // SAFETY: 73 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 81 // SAFETY: It's safe to set the fields of `struct pci_driver` on initialization. in register() 89 // SAFETY: `pdrv` is guaranteed to be a valid `DriverType`. in register() 96 // SAFETY: `pdrv` is guaranteed to be a valid `DriverType`. in unregister() 106 // SAFETY: The PCI bus only ever calls the probe callback with a valid pointer to a in probe_callback() 112 // SAFETY: `DeviceId` is a `#[repr(transparent)]` wrapper of `struct pci_device_id` and in probe_callback() 116 // SAFETY: `id` comes from `T::ID_TABLE` which is of type `IdArray<_, T::IdInfo>` or in probe_callback() 130 // SAFETY: The PCI bus only ever calls the remove callback with a valid pointer to a in remove_callback() 136 // SAFETY in remove_callback() [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() 215 // SAFETY: The tgid of a task never changes after initialization, so reading this field is in uid() 223 // SAFETY in euid() [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. 84 // SAFETY: 95 // SAFETY: A call to `unregister` for a given instance of `DriverType` is guaranteed to be valid if 123 // SAFETY: It's safe to set the fields of `struct i2c_client` on initialization. in register() 134 // SAFETY: `idrv` is guaranteed to be a valid `DriverType`. in register() 139 // SAFETY: `idrv` is guaranteed to be a valid `DriverType`. in unregister() 146 // SAFETY: The I2C bus only ever calls the probe callback with a valid pointer to a in probe_callback() 153 // SAFETY: `idev` matched data is of type `Self::IdInfo`. in probe_callback() 166 // SAFETY: `idev` is a valid pointer to a `struct i2c_client`. in remove_callback() [all …]
|
| H A D | pid_namespace.rs | 32 /// # Safety 37 // SAFETY: The safety requirements guarantee the validity of the dereference, while the in from_ptr() 43 // SAFETY: Instances of `PidNamespace` are always reference-counted. 47 // SAFETY: The existence of a shared reference means that the refcount is nonzero. in inc_ref() 53 // SAFETY: The safety requirements guarantee that the refcount is non-zero. in dec_ref() 58 // SAFETY: 63 // SAFETY: It's OK to access `PidNamespace` through shared references from other threads because
|
| H A D | device.rs | 93 /// // SAFETY: `Device` is a transparent wrapper of a type that doesn't depend on `Device`'s 172 /// # Safety 181 // SAFETY: By the safety requirements ptr is valid in get_device() 187 /// # Safety 194 // CAST: By the safety requirements the caller is responsible to guarantee that the in as_bound() 198 // SAFETY: in as_bound() 210 // SAFETY: By the type invariants, `self.as_raw()` is a valid pointer to a `struct device`. in set_drvdata() 218 /// # Safety 223 // SAFETY: By the type invariants, `self.as_raw()` is a valid pointer to a `struct device`. in drvdata_obtain() 226 // SAFETY: By the type invariants, `self.as_raw()` is a valid pointer to a `struct device`. in drvdata_obtain() [all …]
|
| /linux/rust/kernel/drm/ |
| H A D | device.rs | 219 // SAFETY: 233 // SAFETY: `raw_drm` is a valid pointer to `Self`, given that `__drm_dev_alloc` was in inc_ref() 237 // SAFETY: `raw_drm` is a valid pointer to `Self`. in dec_ref() 240 // SAFETY: in dec_ref() 244 // SAFETY: `__drm_dev_alloc()` was successful, hence `drm_dev` must be valid and the 249 // SAFETY: `drm_dev` is still private to this function. in as_ref() 252 // SAFETY: `raw_drm` is valid; no concurrent access before registration. 255 // SAFETY: The reference count is one, and now we take ownership of that reference as a 287 /// # Safety 291 // SAFETY in raw_get_work() [all...] |
| /linux/rust/zerocopy/src/ |
| H A D | byte_slice.rs | 37 /// # Safety 66 /// # Safety 69 /// required by [`ByteSlice`] (see that trait's safety documentation) do not 77 /// # Safety 80 /// required by [`ByteSlice`] (see that trait's safety documentation) do not 88 /// # Safety 107 /// # Safety 114 // SAFETY: Above, we ensure that `mid <= self.deref().len()`. By in split_at() 130 /// # Safety 148 #[allow(clippy::missing_safety_doc)] // There's a `Safety` section on `into_byte_slice`. [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 | 49 // SAFETY: All GEM objects are refcounted. 56 // SAFETY: The existence of a shared reference guarantees that the refcount is 62 // SAFETY: `obj` is a valid pointer to an `Object<T>`. 65 // SAFETY: The safety requirements guarantee that the refcount is non-zero. 118 /// # Safety in open_callback() 131 // SAFETY: `open_callback` is only ever called with a valid pointer to a `struct drm_file`. in open_callback() 134 // SAFETY: in close_callback() 151 // SAFETY: `open_callback` is only ever called with a valid pointer to a `struct drm_file`. 154 // SAFETY in from_raw() [all...] |
| H A D | shmem.rs | 122 // SAFETY: All GEM objects are thread-safe. in new() 125 // SAFETY: All GEM objects are thread-safe. in new() 145 // SAFETY: `drm_gem_shmem_vm_ops` is a valid, static const on the C side. in new() 157 // SAFETY: `dev` will have been initialized in `Self::new()` by `drm_gem_shmem_init()`. in free_callback() 162 // SAFETY: in free_callback() 168 // SAFETY: in free_callback() 176 // SAFETY: in free_callback() 182 // SAFETY: in deref() 187 // SAFETY: We're recovering the Kbox<> we created in gem_create_object() 204 // SAFETY in from_raw() [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 | 142 // SAFETY: All zeros is equivalent to `None` (option layout optimization guarantee: 146 // SAFETY: `Box` is `Send` if `T` is `Send` because the `Box` owns a `T`. 154 // SAFETY: `Box` is `Sync` if `T` is `Sync` because the `Box` owns a `T`. 169 /// # Safety 178 // INVARIANT: Validity of `raw` is guaranteed by the safety preconditions of this function. 179 // SAFETY: By the safety preconditions of this function, `raw` is not a NULL pointer. in from_raw() 194 /// // SAFETY: `ptr` comes from a previous call to `KBox::into_raw`. 210 // SAFETY: `Box::into_raw` always returns a properly aligned and dereferenceable pointer 225 /// # Safety [all...] |
| H A D | allocator.rs | 85 /// # Safety in call() 87 /// This method has the same safety requirements as [`Allocator::realloc`]. in call() 115 // SAFETY: in call() 118 // - `ptr` is either NULL or valid by the safety requirements of this function. in call() 149 // SAFETY: `realloc` delegates to `ReallocFunc::call`, which guarantees that in realloc() 166 // SAFETY: `ReallocFunc::call` has the same safety requirements as `Allocator::realloc`. 187 /// // SAFETY: By the type invariant of `Box` the inner pointer of `vbox` is non-null. 190 /// // SAFETY: 195 /// // SAFETY in to_page() [all...] |
| /linux/rust/pin-init/src/ |
| H A D | __internal.rs | 70 /// # Safety 82 /// # Safety 95 /// # Safety in make_closure() 127 // SAFETY: TODO. 153 // SAFETY: As we are being dropped, we only call this once. And since `self.is_init` is 176 // SAFETY: We never move out of `this`. 179 // the memory (this is a safety guarantee of `Pin`). 182 // SAFETY: `this.is_init` was true and therefore `this.value` is initialized. in uninit() 185 // SAFETY: The memory slot is valid and this type ensures that it will stay pinned. in uninit() 189 // SAFETY [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...] |
| /linux/rust/zerocopy/src/pointer/ |
| H A D | mod.rs | 57 /// # Safety 59 /// The implementation of `project` must satisfy its safety post-condition. 69 /// # Safety 79 /// # Safety 87 /// # Safety 97 // SAFETY: `project` returns its argument unchanged, and so it is a 107 // SAFETY: The `Project::project` impl preserves referent address. 110 // SAFETY: The `Project::project` impl preserves referent size. 116 /// # Safety 125 // SAFETY: By the `static_assert!`, `Dst` is no larger than `Src`, [all …]
|
| H A D | inner.rs | 66 // SAFETY: `&'a UnsafeCell<T>` is covariant in `'a` and invariant in `T` 78 // SAFETY: None of the invariants on `ptr` are affected by having in clone() 87 /// # Safety 99 // SAFETY: The caller has promised to satisfy all safety invariants in new() 108 /// way that violates the safety invariants of `self`. 119 /// way that violates the safety invariants of `self`. 133 // SAFETY: in from_ref() 140 // [1] Per https://doc.rust-lang.org/1.85.0/std/primitive.reference.html#safety: in from_ref() 159 // SAFETY: in from_mut() 166 // [1] Per https://doc.rust-lang.org/1.85.0/std/primitive.reference.html#safety: in from_mut() [all …]
|