Reset global zero buffer with raid_zero(0) in raid_selftest cleanup

This commit is contained in:
Andrea Mazzoleni 2026-08-24 21:42:22 +02:00
parent eba07d2173
commit 306f847689
2 changed files with 10 additions and 0 deletions

View file

@ -779,6 +779,12 @@ int raid_selftest(void)
ret = 0;
bail:
/*
* Reset the global zero buffer so that it does not point to
* the deallocated memory.
*/
raid_zero(0);
free(v);
free(v_alloc);

View file

@ -161,6 +161,10 @@ int raid_mode(int mode);
* The test modifies global RAID state and must not be called concurrently
* with any other RAID function.
*
* The test resets the zero buffer to 0 via raid_zero(0) upon completion.
* A valid zero buffer must be set with raid_zero() afterwards before calling
* recovery functions (raid_rec(), raid_data()).
*
* It returns 0 on success.
*/
int raid_selftest(void);