Page MenuHomeFreeBSD

ofw: fix memory leak in ofwbus
ClosedPublic

Authored by christos on Mar 4 2023, 2:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 11 2025, 4:03 AM
Unknown Object (File)
Sep 7 2025, 3:12 PM
Unknown Object (File)
Sep 7 2025, 12:41 PM
Unknown Object (File)
Aug 25 2025, 10:00 AM
Unknown Object (File)
Aug 6 2025, 8:29 AM
Unknown Object (File)
Aug 2 2025, 11:17 AM
Unknown Object (File)
Jul 15 2025, 7:45 AM
Unknown Object (File)
Jun 30 2025, 10:36 PM
Subscribers

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I think this is right, but I can't see why we are calling ofw_bus_gen_setup_devinfo() at all. simplebus_add_device() -> simplebus_setup_dinfo() -> ofw_bus_gen_setup_devinfo() does the same thing. I suspect that we could remove the setup_devinfo() call and check the return value of simplebus_add_device() instead.

This revision is now accepted and ready to land.Mar 4 2023, 4:06 PM

I think this is right, but I can't see why we are calling ofw_bus_gen_setup_devinfo() at all. simplebus_add_device() -> simplebus_setup_dinfo() -> ofw_bus_gen_setup_devinfo() does the same thing. I suspect that we could remove the setup_devinfo() call and check the return value of simplebus_add_device() instead.

No objection to this, I'm just not sure how I can test the code so that I can implement this.

I think this is right, but I can't see why we are calling ofw_bus_gen_setup_devinfo() at all. simplebus_add_device() -> simplebus_setup_dinfo() -> ofw_bus_gen_setup_devinfo() does the same thing. I suspect that we could remove the setup_devinfo() call and check the return value of simplebus_add_device() instead.

No objection to this, I'm just not sure how I can test the code so that I can implement this.

The easiest way might be to simply try booting a riscv kernel with this change in QEMU: https://wiki.freebsd.org/riscv/QEMU

Seems to be working fine.

Could you please describe your test? Did you use a risc-v kernel and verify that this code path gets executed?

Yes, I booted a riscv kernel and added a few printfs to make sure the code gets executed.

This revision was automatically updated to reflect the committed changes.