Skip to contentSkip to conversation

KCSAN updates for v6.2

PATCH New Paul E. McKenney 1 participant 2 messages Aug 2, 2024 KCSAN

lore
Share & tools
lore
#0 lore raw

cover KCSAN updates for v6.2

Hello!

This series provide a KCSAN update:

1. Use min() to fix Coccinelle warning, courtesy of Thorsten Blum.

Thanx, Paul

------------------------------------------------------------------------

 debugfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#1 lore raw

PATCH 1/1 kcsan: Use min() to fix Coccinelle warning

From: Thorsten Blum <[email protected]>

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.

---
 kernel/kcsan/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/kcsan/debugfs.c +1 -1
index 1d1d1b0e42489..53b21ae30e00e 100644
@@ -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;
Signature · 1 line
2.40.1