Commit 43d631bf authored by Thorsten Blum's avatar Thorsten Blum Committed by Paul E. McKenney

kcsan: Use min() to fix Coccinelle warning

Fixes the following Coccinelle/coccicheck warning reported by
minmax.cocci:

	WARNING opportunity for min()

Use const size_t instead of int for the result of min().

Compile-tested with CONFIG_KCSAN=y.
Reviewed-by: default avatarMarco Elver <elver@google.com>
Signed-off-by: default avatarThorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 8400291e
......@@ -225,7 +225,7 @@ debugfs_write(struct file *file, const char __user *buf, size_t count, loff_t *o
{
char kbuf[KSYM_NAME_LEN];
char *arg;
int read_len = count < (sizeof(kbuf) - 1) ? count : (sizeof(kbuf) - 1);
const size_t read_len = min(count, sizeof(kbuf) - 1);
if (copy_from_user(kbuf, buf, read_len))
return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment