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, Nov 20, 8:48 PM
Unknown Object (File)
Wed, Nov 19, 1:56 AM
Unknown Object (File)
Sun, Nov 16, 9:29 PM
Unknown Object (File)
Sun, Nov 16, 6:29 AM
Unknown Object (File)
Thu, Nov 6, 1:22 AM
Unknown Object (File)
Wed, Nov 5, 9:41 PM
Unknown Object (File)
Tue, Nov 4, 11:23 AM
Unknown Object (File)
Thu, Oct 30, 12:52 AM
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.