1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

writecache: check watermark value

This commit is contained in:
David Teigland 2020-02-25 10:34:30 -06:00
parent 81d0333067
commit 84eab461c8

View File

@ -5395,6 +5395,8 @@ static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecach
if (!strncmp(key, "high_watermark", strlen("high_watermark"))) { if (!strncmp(key, "high_watermark", strlen("high_watermark"))) {
if (sscanf(val, "%llu", (unsigned long long *)&settings->high_watermark) != 1) if (sscanf(val, "%llu", (unsigned long long *)&settings->high_watermark) != 1)
goto_bad; goto_bad;
if (settings->high_watermark > 100)
goto_bad;
settings->high_watermark_set = 1; settings->high_watermark_set = 1;
return 1; return 1;
} }
@ -5402,6 +5404,8 @@ static int _get_one_writecache_setting(struct cmd_context *cmd, struct writecach
if (!strncmp(key, "low_watermark", strlen("low_watermark"))) { if (!strncmp(key, "low_watermark", strlen("low_watermark"))) {
if (sscanf(val, "%llu", (unsigned long long *)&settings->low_watermark) != 1) if (sscanf(val, "%llu", (unsigned long long *)&settings->low_watermark) != 1)
goto_bad; goto_bad;
if (settings->low_watermark > 100)
goto_bad;
settings->low_watermark_set = 1; settings->low_watermark_set = 1;
return 1; return 1;
} }