From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mark Brown <broonie@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>
Subject: [PATCH v1 1/4] regmap: Switch to use kmemdup_array()
Date: Thu, 6 Jun 2024 19:46:22 +0300 [thread overview]
Message-ID: <20240606164717.3031107-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20240606164717.3031107-1-andriy.shevchenko@linux.intel.com>
Let the kememdup_array() take care about multiplication and possible
overflows.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/base/regmap/regmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 0a34dd3c4f38..88c02b71b2ee 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -2347,7 +2347,7 @@ int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
} else {
void *wval;
- wval = kmemdup(val, val_count * val_bytes, map->alloc_flags);
+ wval = kmemdup_array(val, val_count, val_bytes, map->alloc_flags);
if (!wval)
return -ENOMEM;
--
2.43.0.rc1.1336.g36b5255a03ac
next prev parent reply other threads:[~2024-06-06 16:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 16:46 [PATCH v1 0/4] regmap: Switch to use kmemdup_array() Andy Shevchenko
2024-06-06 16:46 ` Andy Shevchenko [this message]
2024-06-06 16:46 ` [PATCH v1 2/4] regmap: cache: Use correct type of the rb_for_each() parameter Andy Shevchenko
2024-06-06 16:46 ` [PATCH v1 3/4] regmap: cache: Switch to use kmemdup_array() Andy Shevchenko
2024-06-06 16:46 ` [PATCH v1 4/4] regmap: maple: " Andy Shevchenko
2024-06-07 21:58 ` [PATCH v1 0/4] regmap: " 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=20240606164717.3031107-2-andriy.shevchenko@linux.intel.com \
--to=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox