[PATCH 4.14 145/229] tools/thermal: Fix possible path truncations