change behaviour on too large argument

This commit is contained in:
ІО-23 Шмуляр Олег 2024-12-17 21:54:21 +02:00
parent eb6167ae63
commit dbebc0a7cc
1 changed files with 1 additions and 4 deletions

View File

@ -44,10 +44,7 @@ static unsigned int msg_count = 1;
static int __init hello_init(void) static int __init hello_init(void)
{ {
if (msg_count > 10) { BUG_ON(msg_count > 10);
pr_err("Error: msg_count too large (%d > 10)\n", msg_count);
return -EINVAL;
}
if (msg_count == 0 || msg_count >= 5) if (msg_count == 0 || msg_count >= 5)
pr_warn("Warning: msg_count = %d (msg_count == 0 or 5 <= msg_count <= 10)\n", msg_count); pr_warn("Warning: msg_count = %d (msg_count == 0 or 5 <= msg_count <= 10)\n", msg_count);