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)
Thu, Dec 4, 11:31 PM
Unknown Object (File)
Tue, Nov 25, 11:45 PM
Unknown Object (File)
Nov 20 2025, 8:48 PM
Unknown Object (File)
Nov 19 2025, 1:56 AM
Unknown Object (File)
Nov 16 2025, 9:29 PM
Unknown Object (File)
Nov 16 2025, 6:29 AM
Unknown Object (File)
Nov 6 2025, 1:22 AM
Unknown Object (File)
Nov 5 2025, 9:41 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.