From: Dmitry Rokosov <ddrokosov@sberdevices.ru>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, Mark Brown <broonie@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH v1 1/3] regmap: trace: Remove useless check for NULL for bulk ops
Date: Fri, 2 Sep 2022 01:20:20 +0300 [thread overview]
Message-ID: <20220901222020.2iumldsfuhpseqci@Rockosov-MBP> (raw)
In-Reply-To: <20220901132336.33234-1-andriy.shevchenko@linux.intel.com>
On Thu, Sep 01, 2022 at 04:23:34PM +0300, Andy Shevchenko wrote:
> If the buffer pointer is NULL we already are in troubles since
> regmap bulk API expects caller to provide valid parameters,
> it dereferences that without any checks before we call for
> traces.
>
> Moreover, the current code will print garbage in the case of
> buffer is NULL and length is not 0.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/base/regmap/trace.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/base/regmap/trace.h b/drivers/base/regmap/trace.h
> index 04329ba68ec5..e92edc4f4ca5 100644
> --- a/drivers/base/regmap/trace.h
> +++ b/drivers/base/regmap/trace.h
> @@ -82,8 +82,7 @@ DECLARE_EVENT_CLASS(regmap_bulk,
> __assign_str(name, regmap_name(map));
> __entry->reg = reg;
> __entry->val_len = val_len;
> - if (val)
> - memcpy(__get_dynamic_array(buf), val, val_len);
> + memcpy(__get_dynamic_array(buf), val, val_len);
> ),
>
> TP_printk("%s reg=%x val=%s", __get_str(name),
> --
> 2.35.1
>
Reviewed-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
--
Thank you,
Dmitry
next prev parent reply other threads:[~2022-09-01 22:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 13:23 [PATCH v1 1/3] regmap: trace: Remove useless check for NULL for bulk ops Andy Shevchenko
2022-09-01 13:23 ` [PATCH v1 2/3] regmap: trace: Remove explicit castings Andy Shevchenko
2022-09-01 13:31 ` Mark Brown
2022-09-01 14:18 ` Andy Shevchenko
2022-09-01 14:46 ` Steven Rostedt
2022-09-01 14:50 ` Mark Brown
2022-09-01 15:28 ` Steven Rostedt
2022-09-01 22:22 ` Dmitry Rokosov
2022-09-01 13:23 ` [PATCH v1 3/3] regmap: trace: Remove unneeded blank lines Andy Shevchenko
2022-09-01 22:22 ` Dmitry Rokosov
2022-09-01 22:20 ` Dmitry Rokosov [this message]
2022-09-05 17:44 ` [PATCH v1 1/3] regmap: trace: Remove useless check for NULL for bulk ops Mark Brown
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=20220901222020.2iumldsfuhpseqci@Rockosov-MBP \
--to=ddrokosov@sberdevices.ru \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.