Fix potential crash during thermal spingdown

This commit is contained in:
Andrea Mazzoleni 2026-02-25 19:04:45 +01:00
parent 2f7ac6996c
commit 1e79a19409
2 changed files with 6 additions and 4 deletions

View file

@ -2818,8 +2818,9 @@ retry:
log_tag("attr:%s:%s:power:active\n", file, name);
*power = POWER_ACTIVE;
/* store the return smartctl return value */
smart[SMART_FLAGS].raw = WEXITSTATUS(ret);
/* store the smartctl return value */
if (smart)
smart[SMART_FLAGS].raw = WEXITSTATUS(ret);
}
return 0;

View file

@ -1794,8 +1794,9 @@ static int devprobe(dev_t device, const char* name, const char* smartctl, int* p
log_tag("attr:%s:%s:power:active\n", file, name);
*power = POWER_ACTIVE;
/* store the return smartctl return value */
smart[SMART_FLAGS].raw = WEXITSTATUS(ret);
/* store the smartctl return value */
if (smart)
smart[SMART_FLAGS].raw = WEXITSTATUS(ret);
}
return 0;