Re: [PATCH v2 1/7] rust: firmware: add request_into_buf()
Timur Tabi <[email protected]>
| Newsgroups | dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2026-06-30 at 23:09 +0200, Danilo Krummrich wrote:
> > + let ret = unsafe {
> > + bindings::request_firmware_into_buf(
> > + pfw,
> > + name.as_char_ptr(),
> > + dev.as_raw(),
> > + buf.as_mut_ptr().cast(),
>
> Sashiko's concern about buf being an empty slice, despite being nonsensical,
> seems valid. The allocated_size field in struct fw_priv, if set to zero, is
> interpreted as "the driver did not provide a buffer" and hence the firmware
> loader assumes that it has to treat the data pointer as a self-allocated buffer.
> In the case of passing an empty slice, this would be a dangling pointer.
Ok, I will return an error on an empty slice. Thanks.