mirror of https://github.com/torvalds/linux.git
The Rust `Regulator` abstraction uses `NonNull` to wrap the underlying
`struct regulator` pointer. When `CONFIG_REGULATOR` is disabled, the C
stub for `regulator_get` returns `NULL`. `from_err_ptr` does not treat
`NULL` as an error, so it was passed to `NonNull::new_unchecked`,
causing undefined behavior.
Fix this by using a raw pointer `*mut bindings::regulator` instead of
`NonNull`. This allows `inner` to be `NULL` when `CONFIG_REGULATOR` is
disabled, and leverages the C stubs which are designed to handle `NULL`
or are no-ops.
Fixes:
|
||
|---|---|---|
| .. | ||
| alloc | ||
| block | ||
| debugfs | ||
| device | ||
| drm | ||
| fs | ||
| io | ||
| iommu | ||
| irq | ||
| list | ||
| mm | ||
| net | ||
| num | ||
| pci | ||
| ptr | ||
| str | ||
| sync | ||
| time | ||
| .gitignore | ||
| acpi.rs | ||
| alloc.rs | ||
| auxiliary.rs | ||
| bitmap.rs | ||
| bits.rs | ||
| block.rs | ||
| bug.rs | ||
| build_assert.rs | ||
| clk.rs | ||
| configfs.rs | ||
| cpu.rs | ||
| cpufreq.rs | ||
| cpumask.rs | ||
| cred.rs | ||
| debugfs.rs | ||
| device.rs | ||
| device_id.rs | ||
| devres.rs | ||
| dma.rs | ||
| driver.rs | ||
| error.rs | ||
| faux.rs | ||
| firmware.rs | ||
| fmt.rs | ||
| fs.rs | ||
| generated_arch_reachable_asm.rs.S | ||
| generated_arch_static_branch_asm.rs.S | ||
| generated_arch_warn_asm.rs.S | ||
| i2c.rs | ||
| id_pool.rs | ||
| impl_flags.rs | ||
| init.rs | ||
| io.rs | ||
| ioctl.rs | ||
| iov.rs | ||
| irq.rs | ||
| jump_label.rs | ||
| kunit.rs | ||
| lib.rs | ||
| list.rs | ||
| maple_tree.rs | ||
| miscdevice.rs | ||
| mm.rs | ||
| module_param.rs | ||
| net.rs | ||
| num.rs | ||
| of.rs | ||
| opp.rs | ||
| page.rs | ||
| pci.rs | ||
| pid_namespace.rs | ||
| platform.rs | ||
| prelude.rs | ||
| print.rs | ||
| processor.rs | ||
| ptr.rs | ||
| pwm.rs | ||
| rbtree.rs | ||
| regulator.rs | ||
| revocable.rs | ||
| safety.rs | ||
| scatterlist.rs | ||
| security.rs | ||
| seq_file.rs | ||
| sizes.rs | ||
| slice.rs | ||
| soc.rs | ||
| static_assert.rs | ||
| std_vendor.rs | ||
| str.rs | ||
| sync.rs | ||
| task.rs | ||
| time.rs | ||
| tracepoint.rs | ||
| transmute.rs | ||
| types.rs | ||
| uaccess.rs | ||
| usb.rs | ||
| workqueue.rs | ||
| xarray.rs | ||