From: David Laight <David.Laight@ACULAB.COM>
To: 'Andy Shevchenko' <andriy.shevchenko@linux.intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
"kasan-dev@googlegroups.com" <kasan-dev@googlegroups.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
Alexander Potapenko <glider@google.com>,
Andrey Konovalov <andreyknvl@gmail.com>,
Dmitry Vyukov <dvyukov@google.com>,
Vincenzo Frascino <vincenzo.frascino@arm.com>
Subject: RE: [PATCH v1 1/1] kasan: Replace strreplace() with strchrnul()
Date: Thu, 29 Jun 2023 14:32:13 +0000 [thread overview]
Message-ID: <6b241f45a61f40fe9b221696289fd658@AcuMS.aculab.com> (raw)
In-Reply-To: <20230628153342.53406-1-andriy.shevchenko@linux.intel.com>
From: Andy Shevchenko
> Sent: 28 June 2023 16:34
>
> We don't need to traverse over the entire string and replace
> occurrences of a character with '\0'. The first match will
> suffice. Hence, replace strreplace() with strchrnul().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> mm/kasan/report_generic.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/kasan/report_generic.c b/mm/kasan/report_generic.c
> index 51a1e8a8877f..63a34eac4a8c 100644
> --- a/mm/kasan/report_generic.c
> +++ b/mm/kasan/report_generic.c
> @@ -264,6 +264,7 @@ static void print_decoded_frame_descr(const char *frame_descr)
> while (num_objects--) {
> unsigned long offset;
> unsigned long size;
> + char *p;
>
> /* access offset */
> if (!tokenize_frame_descr(&frame_descr, token, sizeof(token),
> @@ -282,7 +283,7 @@ static void print_decoded_frame_descr(const char *frame_descr)
> return;
>
> /* Strip line number; without filename it's not very helpful. */
> - strreplace(token, ':', '\0');
> + p[strchrnul(token, ':') - token] = '\0';
Isn't 'p' undefined here?
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2023-06-29 14:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 15:33 Andy Shevchenko
2023-06-28 15:39 ` Alexander Potapenko
2023-06-29 9:22 ` Andy Shevchenko
2023-06-29 14:32 ` David Laight [this message]
2023-06-29 14:41 ` 'Andy Shevchenko'
2023-07-03 10:50 ` Andy Shevchenko
2023-07-19 5:36 ` kernel test robot
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=6b241f45a61f40fe9b221696289fd658@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryabinin.a.a@gmail.com \
--cc=vincenzo.frascino@arm.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