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, Sep 17, 1:22 PM
Unknown Object (File)
Tue, Sep 17, 2:53 AM
Unknown Object (File)
Mon, Sep 16, 12:37 PM
Unknown Object (File)
Sat, Sep 7, 7:16 PM
Unknown Object (File)
Thu, Sep 5, 4:57 AM
Unknown Object (File)
Aug 4 2024, 3:26 PM
Unknown Object (File)
Jul 24 2024, 3:26 AM
Unknown Object (File)
Jul 22 2024, 3:02 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.