* [PATCH kcsan 0/1] KCSAN updates for v6.2
@ 2024-08-02 0:24 Paul E. McKenney
2024-08-02 0:24 ` [PATCH kcsan 1/1] kcsan: Use min() to fix Coccinelle warning Paul E. McKenney
0 siblings, 1 reply; 2+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:24 UTC (permalink / raw)
To: linux-kernel, kasan-dev, kernel-team, mingo
Cc: elver, andreyknvl, glider, dvyukov, cai, boqun.feng
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(-)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH kcsan 1/1] kcsan: Use min() to fix Coccinelle warning
2024-08-02 0:24 [PATCH kcsan 0/1] KCSAN updates for v6.2 Paul E. McKenney
@ 2024-08-02 0:24 ` Paul E. McKenney
0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2024-08-02 0:24 UTC (permalink / raw)
To: linux-kernel, kasan-dev, kernel-team, mingo
Cc: elver, andreyknvl, glider, dvyukov, cai, boqun.feng,
Thorsten Blum, Paul E . McKenney
From: Thorsten Blum <thorsten.blum@toblux.com>
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: Marco Elver <elver@google.com>
Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/kcsan/debugfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c
index 1d1d1b0e42489..53b21ae30e00e 100644
--- a/kernel/kcsan/debugfs.c
+++ b/kernel/kcsan/debugfs.c
@@ -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;
--
2.40.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-02 0:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-02 0:24 [PATCH kcsan 0/1] KCSAN updates for v6.2 Paul E. McKenney
2024-08-02 0:24 ` [PATCH kcsan 1/1] kcsan: Use min() to fix Coccinelle warning Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®