From: Michael Ugrin <mugrinphoto@gmail.com>
To: hansg@kernel.org, mchehab@kernel.org
Cc: sakari.ailus@linux.intel.com, andy@kernel.org,
gregkh@linuxfoundation.org, Dan Carpenter <error27@gmail.com>,
David Laight <david.laight.linux@gmail.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev,
Michael Ugrin <mugrinphoto@gmail.com>
Subject: [PATCH v2] staging: media: atomisp: use umin() for strscpy size arguments
Date: Sat, 11 Apr 2026 10:34:05 -0700 [thread overview]
Message-ID: <20260411173405.14485-1-mugrinphoto@gmail.com> (raw)
In-Reply-To: <20260411005512.46142-1-mugrinphoto@gmail.com>
Replace open-coded ternary min expressions with umin() in
strscpy() calls, as suggested by Dan Carpenter.
Signed-off-by: Michael Ugrin <mugrinphoto@gmail.com>
---
.../atomisp/pci/runtime/debug/src/ia_css_debug.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
index b411ca2f415e0..60bb10dac5891 100644
--- a/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
+++ b/drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c
@@ -1256,8 +1256,7 @@ ia_css_debug_pipe_graph_dump_stage(
while (ei[p] != ',')
p--;
/* Last comma found, copy till that comma */
- strscpy(enable_info1, ei,
- p > sizeof(enable_info1) ? sizeof(enable_info1) : p);
+ strscpy(enable_info1, ei, umin(p, sizeof(enable_info1)));
ei += p + 1;
l = strlen(ei);
@@ -1268,8 +1267,7 @@ ia_css_debug_pipe_graph_dump_stage(
* it is not guaranteed dword aligned
*/
- strscpy(enable_info2, ei,
- l > sizeof(enable_info2) ? sizeof(enable_info2) : l);
+ strscpy(enable_info2, ei, umin(l, sizeof(enable_info2)));
snprintf(enable_info, sizeof(enable_info), "%s\\n%s",
enable_info1, enable_info2);
@@ -1280,8 +1278,7 @@ ia_css_debug_pipe_graph_dump_stage(
while (ei[p] != ',')
p--;
- strscpy(enable_info2, ei,
- p > sizeof(enable_info2) ? sizeof(enable_info2) : p);
+ strscpy(enable_info2, ei, umin(p, sizeof(enable_info2)));
ei += p + 1;
l = strlen(ei);
@@ -1303,7 +1300,7 @@ ia_css_debug_pipe_graph_dump_stage(
while (ei[p] != ',')
p--;
strscpy(enable_info3, ei,
- p > sizeof(enable_info3) ? sizeof(enable_info3) : p);
+ umin(p, sizeof(enable_info3)));
ei += p + 1;
strscpy(enable_info3, ei,
sizeof(enable_info3));
--
2.43.0
prev parent reply other threads:[~2026-04-11 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-11 0:55 [PATCH] staging: media: atomisp: fix indentation to use tabs instead of spaces Michael Ugrin
2026-04-11 10:51 ` Dan Carpenter
2026-04-11 14:42 ` David Laight
2026-04-11 17:13 ` Michael Ugrin
2026-04-11 17:34 ` Michael Ugrin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260411173405.14485-1-mugrinphoto@gmail.com \
--to=mugrinphoto@gmail.com \
--cc=andy@kernel.org \
--cc=david.laight.linux@gmail.com \
--cc=error27@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=sakari.ailus@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox