fix(agent): add safety check for read returning negative bytes (#1799)

This commit is contained in:
henrygd
2026-04-07 18:41:22 -04:00
parent c3dffff5e4
commit ea80f3c5a2
2 changed files with 5 additions and 0 deletions

View File

@@ -156,6 +156,7 @@ func (gm *GPUManager) updateAmdGpuData(cardPath string) bool {
func readSysfsFloat(path string) (float64, error) {
val, err := utils.ReadStringFileLimited(path, 64)
if err != nil {
slog.Debug("Failed to read sysfs value", "path", path, "error", err)
return 0, err
}
return strconv.ParseFloat(val, 64)