From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: "Mika Westerberg" <westeri@kernel.org>,
"Andi Shyti" <andi.shyti@kernel.org>,
"Corey Minyard" <corey@minyard.net>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
platform-driver-x86@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 8/8] power: supply: sbs-battery: use 4-argument i2c_smbus_read_block_data()
Date: Mon, 9 Nov 2026 00:52:18 +0100 [thread overview]
Message-ID: <avELD9tlEfl9Uth7@venus> (raw)
In-Reply-To: <20261024-i2c-smbus-read-block-data-v1-8-19bb97467982@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]
Hi,
On Sat, Oct 24, 2026 at 07:48:48PM -0700, Dmitry Torokhov wrote:
> Pass the destination buffer size to sbs_read_string_data(), and pass
> the buffer capacity reserving space for a trailing NUL terminator to
> i2c_smbus_read_block_data().
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
-- Sebastian
> drivers/power/supply/sbs-battery.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index 6714313bb3a3..f8b194c58a62 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -424,7 +424,8 @@ static int sbs_read_string_data_fallback(struct i2c_client *client, u8 address,
> return ret;
> }
>
> -static int sbs_read_string_data(struct i2c_client *client, u8 address, char *values)
> +static int sbs_read_string_data(struct i2c_client *client, u8 address,
> + char *values, size_t size)
> {
> struct sbs_info *chip = i2c_get_clientdata(client);
> int retries = chip->i2c_retry_count;
> @@ -440,7 +441,7 @@ static int sbs_read_string_data(struct i2c_client *client, u8 address, char *val
> }
>
> while (retries > 0) {
> - ret = i2c_smbus_read_block_data(client, address, values);
> + ret = i2c_smbus_read_block_data(client, address, size - 1, values);
> if (ret >= 0)
> break;
> retries--;
> @@ -709,7 +710,8 @@ static const char *sbs_get_constant_string(struct sbs_info *chip,
>
> addr = sbs_data[ret].addr;
>
> - ret = sbs_read_string_data(chip->client, addr, buf);
> + ret = sbs_read_string_data(chip->client, addr, buf,
> + sizeof(chip->strings[0]));
> if (ret < 0)
> return ERR_PTR(ret);
> }
>
> --
> 2.56.0.257.gf7497c7d27-goog
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2026-11-08 23:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 2:48 [PATCH 0/8] i2c: convert i2c_smbus_read_block_data() users to pass buffer length Dmitry Torokhov
2026-10-25 2:48 ` [PATCH 1/8] i2c: acpi: use 4-argument i2c_smbus_read_block_data() Dmitry Torokhov
2026-10-26 8:52 ` Mika Westerberg
2026-10-25 2:48 ` [PATCH 2/8] i2c: docs: update i2c_smbus_read_block_data() prototype in writing-clients Dmitry Torokhov
2026-10-28 18:00 ` Andi Shyti
2026-11-03 20:04 ` Dmitry Torokhov
2026-10-25 2:48 ` [PATCH 3/8] Input: cyapa - use 4-argument i2c_smbus_read_block_data() Dmitry Torokhov
2026-10-25 2:48 ` [PATCH 4/8] Input: elan_i2c " Dmitry Torokhov
2026-10-25 2:48 ` [PATCH 5/8] Input: synaptics-rmi4 " Dmitry Torokhov
2026-10-25 2:48 ` [PATCH 6/8] ipmi: ssif: " Dmitry Torokhov
2026-10-28 19:30 ` Corey Minyard
2026-10-25 2:48 ` [PATCH 7/8] platform/x86: x86-android-tablets: " Dmitry Torokhov
2026-10-26 11:48 ` Hans de Goede
2026-10-25 2:48 ` [PATCH 8/8] power: supply: sbs-battery: " Dmitry Torokhov
2026-11-08 23:52 ` Sebastian Reichel [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=avELD9tlEfl9Uth7@venus \
--to=sebastian.reichel@collabora.com \
--cc=andi.shyti@kernel.org \
--cc=corey@minyard.net \
--cc=dmitry.torokhov@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=platform-driver-x86@vger.kernel.org \
--cc=westeri@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
all inboxes | Powered by JetHome®