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)
Tue, Dec 17, 11:13 PM
Unknown Object (File)
Thu, Dec 12, 1:40 AM
Unknown Object (File)
Oct 16 2024, 1:00 PM
Unknown Object (File)
Oct 16 2024, 11:56 AM
Unknown Object (File)
Oct 16 2024, 11:55 AM
Unknown Object (File)
Oct 2 2024, 6:38 PM
Unknown Object (File)
Sep 30 2024, 6:27 PM
Unknown Object (File)
Sep 29 2024, 8:32 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.