selftests: ALSA: pcmtest: Make room for the longest fill pattern

The driver accepts fill patterns of up to 4096 bytes, as pcmtest.rst
documents. The test reads each pattern into a 1024-byte buffer, using
the length the driver reports. So a pattern longer than 1024 bytes
overflows the buffer into the next pattern and past the array.

Size the buffer to the driver's maximum.

Fixes: 10b98a4db1 ("selftests: ALSA: Add test for the 'pcmtest' driver")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/7cbbcef84d2c14a2f0ec0ad2ba55c6ba0a15a8d8.1792390197.git.sammiee5311@gmail.com
This commit is contained in:
HyeongJun An 2026-10-20 19:18:37 +09:00 committed by Takashi Iwai
parent 317f2ddb66
commit c338e77291

View File

@ -10,9 +10,11 @@
#include "kselftest_harness.h"
#define CH_NUM 4
/* The driver accepts patterns of up to 4096 bytes */
#define MAX_PATTERN_LEN 4096
struct pattern_buf {
char buf[1024];
char buf[MAX_PATTERN_LEN];
int len;
};