From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Neal Patalay <nealpatalay0@gmail.com>
Cc: andy@kernel.org, hansg@kernel.org, mchehab@kernel.org,
gregkh@linuxfoundation.org, sakari.ailus@linux.intel.com,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev, mugrinphoto@gmail.com,
matt@mattwardle.net
Subject: Re: [PATCH v3] staging: media: atomisp: refactor pipe graph dump stage formatting
Date: Sun, 5 Jul 2026 17:22:30 +0300 [thread overview]
Message-ID: <akpopoFZyWW2e9En@ashevche-desk.local> (raw)
In-Reply-To: <20260705073844.146578-1-nealpatalay0@gmail.com>
On Sun, Jul 05, 2026 at 12:38:44AM -0700, Neal Patalay wrote:
> The original implementation of ia_css_debug_pipe_graph_dump_stage()
> includes an off-by-one error where the original strscpy() size dropped
> characters immediately before newlines. It also allocates over 600
> bytes across multiple buffers on the stack. Address these shortcomings
> and reduce stack usage with a single 256 byte buffer via a new helper
> function, ia_css_debug_build_info().
...
> +static void ia_css_debug_build_info(char *info, size_t info_size,
> + int *offset,
> + const char *flag_str, size_t flag_str_size,
> + int *line_len)
> +{
> + int len = *line_len;
> + int off = *offset;
> + int len_written;
The blank line must divide the definition and code blocks.
> + /*
> + * If new line length exceeds max line length,
> + * replace the last ',' with a "\\n"
Missing period at the end.
> + */
> + if (len > 0 && info_size - off >= 2 &&
> + len + flag_str_size > ENABLE_LINE_MAX_LENGTH) {
> + info[off - 1] = '\\';
If for some reason len is > 0 and offset is 0, this will write beyond
the boundaries.
> + info[off] = 'n';
> + off += 1;
> + len = 0;
> + }
> + len_written = scnprintf(info + off, info_size - off,
> + "%s,", flag_str);
Broken indentation. Note the statement fits a single line.
> + *offset = off + len_written;
> + *line_len = len + len_written;
> +}
This will continue writing even if there are more than 3 lines.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-07-05 14:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 7:38 [PATCH v3] staging: media: atomisp: refactor pipe graph dump stage formatting Neal Patalay
2026-07-05 14:22 ` Andy Shevchenko [this message]
2026-07-05 23:56 ` Neal Patalay
2026-07-06 5:11 ` Andy Shevchenko
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=akpopoFZyWW2e9En@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--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=matt@mattwardle.net \
--cc=mchehab@kernel.org \
--cc=mugrinphoto@gmail.com \
--cc=nealpatalay0@gmail.com \
--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