[PATCH 5.15 659/779] tools/thermal: Fix possible path truncations