On 7/29/25 4:51 PM, Lucien.Jheng wrote:

[...]

+int request_firmware_into_buf_via_script(void **buf, size_t max_size,
+                                      const char *script_name)
+{

[...]

+       *buf = (void *)memdup((void *)addr, size);
+       if (!*buf) {
+               log_err("Failed to allocate memory for firmware copy.\n");
+               return -ENOMEM;
+       }
One more nitpick, do we want to memdup() the firmware here, or would it be better if user passed an already pre-allocated buffer pointer into this function and this function would only copy up to 'max_size' bytes into that buffer ?

This:

int request_firmware_into_buf_via_script(void *buf, size_t max_size,
                                         const char *script_name)
...
memcpy(buf, addr, min(size, max_size));
...

What do you think ?

Also, I would really like if someone else voiced their opinion this firmware loading mechanism.

Reply via email to