public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 1/6] soc: qcom: Add check devm_kasprintf() returned value
@ 2024-11-12 10:37 Sasha Levin
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 2/6] regulator: rk808: Add apply_bit for BUCK3 on RK809 Sasha Levin
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Sasha Levin @ 2024-11-12 10:37 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Charles Han, Bjorn Andersson, Sasha Levin, konradybcio,
	linux-arm-msm

From: Charles Han <hanchunchao@inspur.com>

[ Upstream commit e694d2b5c58ba2d1e995d068707c8d966e7f5f2a ]

devm_kasprintf() can return a NULL pointer on failure but this
returned value in qcom_socinfo_probe() is not checked.

Signed-off-by: Charles Han <hanchunchao@inspur.com>
Link: https://lore.kernel.org/r/20240929072349.202520-1-hanchunchao@inspur.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/soc/qcom/socinfo.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index 60c82dcaa8d1d..7bb3543e42e59 100644
--- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c
@@ -507,10 +507,16 @@ static int qcom_socinfo_probe(struct platform_device *pdev)
 	qs->attr.revision = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%u.%u",
 					   SOCINFO_MAJOR(le32_to_cpu(info->ver)),
 					   SOCINFO_MINOR(le32_to_cpu(info->ver)));
-	if (offsetof(struct socinfo, serial_num) <= item_size)
+	if (!qs->attr.soc_id || qs->attr.revision)
+		return -ENOMEM;
+
+	if (offsetof(struct socinfo, serial_num) <= item_size) {
 		qs->attr.serial_number = devm_kasprintf(&pdev->dev, GFP_KERNEL,
 							"%u",
 							le32_to_cpu(info->serial_num));
+		if (!qs->attr.serial_number)
+			return -ENOMEM;
+	}
 
 	qs->soc_dev = soc_device_register(&qs->attr);
 	if (IS_ERR(qs->soc_dev))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH AUTOSEL 5.10 2/6] regulator: rk808: Add apply_bit for BUCK3 on RK809
  2024-11-12 10:37 [PATCH AUTOSEL 5.10 1/6] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
@ 2024-11-12 10:37 ` Sasha Levin
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 3/6] can: j1939: fix error in J1939 documentation Sasha Levin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Sasha Levin @ 2024-11-12 10:37 UTC (permalink / raw)
  To: linux-kernel, stable; +Cc: Mikhail Rudenko, Mark Brown, Sasha Levin, lgirdwood

From: Mikhail Rudenko <mike.rudenko@gmail.com>

[ Upstream commit 5e53e4a66bc7430dd2d11c18a86410e3a38d2940 ]

Currently, RK809's BUCK3 regulator is modelled in the driver as a
configurable regulator with 0.5-2.4V voltage range. But the voltage
setting is not actually applied, because when bit 6 of
PMIC_POWER_CONFIG register is set to 0 (default), BUCK3 output voltage
is determined by the external feedback resistor. Fix this, by setting
bit 6 when voltage selection is set. Existing users which do not
specify voltage constraints in their device trees will not be affected
by this change, since no voltage setting is applied in those cases,
and bit 6 is not enabled.

Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com>
Link: https://patch.msgid.link/20241017-rk809-dcdc3-v1-1-e3c3de92f39c@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/regulator/rk808-regulator.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
index e926c1a858460..e3b9d5ce8dbbf 100644
--- a/drivers/regulator/rk808-regulator.c
+++ b/drivers/regulator/rk808-regulator.c
@@ -944,6 +944,8 @@ static const struct regulator_desc rk809_reg[] = {
 		.n_linear_ranges = ARRAY_SIZE(rk817_buck1_voltage_ranges),
 		.vsel_reg = RK817_BUCK3_ON_VSEL_REG,
 		.vsel_mask = RK817_BUCK_VSEL_MASK,
+		.apply_reg = RK817_POWER_CONFIG,
+		.apply_bit = RK817_BUCK3_FB_RES_INTER,
 		.enable_reg = RK817_POWER_EN_REG(0),
 		.enable_mask = ENABLE_MASK(RK817_ID_DCDC3),
 		.enable_val = ENABLE_MASK(RK817_ID_DCDC3),
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH AUTOSEL 5.10 3/6] can: j1939: fix error in J1939 documentation.
  2024-11-12 10:37 [PATCH AUTOSEL 5.10 1/6] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 2/6] regulator: rk808: Add apply_bit for BUCK3 on RK809 Sasha Levin
@ 2024-11-12 10:37 ` Sasha Levin
  2024-12-02 11:59   ` Pavel Machek
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 4/6] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Sasha Levin @ 2024-11-12 10:37 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Alexander Hölzl, Oleksij Rempel, Vincent Mailhol,
	Marc Kleine-Budde, Sasha Levin, robin, davem, edumazet, kuba,
	pabeni, corbet, linux-can, netdev, linux-doc

From: Alexander Hölzl <alexander.hoelzl@gmx.net>

[ Upstream commit b6ec62e01aa4229bc9d3861d1073806767ea7838 ]

The description of PDU1 format usage mistakenly referred to PDU2 format.

Signed-off-by: Alexander Hölzl <alexander.hoelzl@gmx.net>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20241023145257.82709-1-alexander.hoelzl@gmx.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 Documentation/networking/j1939.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
index 0a4b73b03b997..59f81ba411608 100644
--- a/Documentation/networking/j1939.rst
+++ b/Documentation/networking/j1939.rst
@@ -83,7 +83,7 @@ format, the Group Extension is set in the PS-field.
 
 On the other hand, when using PDU1 format, the PS-field contains a so-called
 Destination Address, which is _not_ part of the PGN. When communicating a PGN
-from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
+from user space to kernel (or vice versa) and PDU1 format is used, the PS-field
 of the PGN shall be set to zero. The Destination Address shall be set
 elsewhere.
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH AUTOSEL 5.10 4/6] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()
  2024-11-12 10:37 [PATCH AUTOSEL 5.10 1/6] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 2/6] regulator: rk808: Add apply_bit for BUCK3 on RK809 Sasha Levin
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 3/6] can: j1939: fix error in J1939 documentation Sasha Levin
@ 2024-11-12 10:37 ` Sasha Levin
  2024-12-02 12:01   ` Pavel Machek
  2024-11-12 10:38 ` [PATCH AUTOSEL 5.10 5/6] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin
  2024-11-12 10:38 ` [PATCH AUTOSEL 5.10 6/6] proc/softirqs: replace seq_printf with seq_put_decimal_ull_width Sasha Levin
  4 siblings, 1 reply; 8+ messages in thread
From: Sasha Levin @ 2024-11-12 10:37 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Luo Yifan, Mark Brown, Sasha Levin, olivier.moysan,
	arnaud.pouliquen, lgirdwood, perex, tiwai, mcoquelin.stm32,
	alexandre.torgue, alsa-devel, linux-sound, linux-stm32,
	linux-arm-kernel

From: Luo Yifan <luoyifan@cmss.chinamobile.com>

[ Upstream commit 63c1c87993e0e5bb11bced3d8224446a2bc62338 ]

This patch checks if div is less than or equal to zero (div <= 0). If
div is zero or negative, the function returns -EINVAL, ensuring the
division operation (*prate / div) is safe to perform.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Link: https://patch.msgid.link/20241106014654.206860-1-luoyifan@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/stm/stm32_sai_sub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index 3aa1cf2624020..3a7f0102b4c5c 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -380,8 +380,8 @@ static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate,
 	int div;
 
 	div = stm32_sai_get_clk_div(sai, *prate, rate);
-	if (div < 0)
-		return div;
+	if (div <= 0)
+		return -EINVAL;
 
 	mclk->freq = *prate / div;
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH AUTOSEL 5.10 5/6] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()
  2024-11-12 10:37 [PATCH AUTOSEL 5.10 1/6] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
                   ` (2 preceding siblings ...)
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 4/6] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
@ 2024-11-12 10:38 ` Sasha Levin
  2024-11-12 10:38 ` [PATCH AUTOSEL 5.10 6/6] proc/softirqs: replace seq_printf with seq_put_decimal_ull_width Sasha Levin
  4 siblings, 0 replies; 8+ messages in thread
From: Sasha Levin @ 2024-11-12 10:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Luo Yifan, Olivier Moysan, Mark Brown, Sasha Levin,
	arnaud.pouliquen, lgirdwood, perex, tiwai, mcoquelin.stm32,
	alexandre.torgue, alsa-devel, linux-sound, linux-stm32,
	linux-arm-kernel

From: Luo Yifan <luoyifan@cmss.chinamobile.com>

[ Upstream commit 23569c8b314925bdb70dd1a7b63cfe6100868315 ]

This patch checks if div is less than or equal to zero (div <= 0). If
div is zero or negative, the function returns -EINVAL, ensuring the
division operation is safe to perform.

Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
Reviewed-by: Olivier Moysan <olivier.moysan@foss.st.com>
Link: https://patch.msgid.link/20241107015936.211902-1-luoyifan@cmss.chinamobile.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 sound/soc/stm/stm32_sai_sub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index 3a7f0102b4c5c..90e4757f76b0f 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -319,7 +319,7 @@ static int stm32_sai_get_clk_div(struct stm32_sai_sub_data *sai,
 	int div;
 
 	div = DIV_ROUND_CLOSEST(input_rate, output_rate);
-	if (div > SAI_XCR1_MCKDIV_MAX(version)) {
+	if (div > SAI_XCR1_MCKDIV_MAX(version) || div <= 0) {
 		dev_err(&sai->pdev->dev, "Divider %d out of range\n", div);
 		return -EINVAL;
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH AUTOSEL 5.10 6/6] proc/softirqs: replace seq_printf with seq_put_decimal_ull_width
  2024-11-12 10:37 [PATCH AUTOSEL 5.10 1/6] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
                   ` (3 preceding siblings ...)
  2024-11-12 10:38 ` [PATCH AUTOSEL 5.10 5/6] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin
@ 2024-11-12 10:38 ` Sasha Levin
  4 siblings, 0 replies; 8+ messages in thread
From: Sasha Levin @ 2024-11-12 10:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: David Wang, Linus Torvalds, Sasha Levin, linux-fsdevel

From: David Wang <00107082@163.com>

[ Upstream commit 84b9749a3a704dcc824a88aa8267247c801d51e4 ]

seq_printf is costy, on a system with n CPUs, reading /proc/softirqs
would yield 10*n decimal values, and the extra cost parsing format string
grows linearly with number of cpus. Replace seq_printf with
seq_put_decimal_ull_width have significant performance improvement.
On an 8CPUs system, reading /proc/softirqs show ~40% performance
gain with this patch.

Signed-off-by: David Wang <00107082@163.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/proc/softirqs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/softirqs.c b/fs/proc/softirqs.c
index 12901dcf57e2b..d8f4e7d54d002 100644
--- a/fs/proc/softirqs.c
+++ b/fs/proc/softirqs.c
@@ -19,7 +19,7 @@ static int show_softirqs(struct seq_file *p, void *v)
 	for (i = 0; i < NR_SOFTIRQS; i++) {
 		seq_printf(p, "%12s:", softirq_to_name[i]);
 		for_each_possible_cpu(j)
-			seq_printf(p, " %10u", kstat_softirqs_cpu(i, j));
+			seq_put_decimal_ull_width(p, " ", kstat_softirqs_cpu(i, j), 10);
 		seq_putc(p, '\n');
 	}
 	return 0;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH AUTOSEL 5.10 3/6] can: j1939: fix error in J1939 documentation.
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 3/6] can: j1939: fix error in J1939 documentation Sasha Levin
@ 2024-12-02 11:59   ` Pavel Machek
  0 siblings, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2024-12-02 11:59 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Alexander Hölzl, Oleksij Rempel,
	Vincent Mailhol, Marc Kleine-Budde, robin, davem, edumazet, kuba,
	pabeni, corbet, linux-can, netdev, linux-doc

[-- Attachment #1: Type: text/plain, Size: 1556 bytes --]

Hi!

> From: Alexander Hölzl <alexander.hoelzl@gmx.net>
> 
> [ Upstream commit b6ec62e01aa4229bc9d3861d1073806767ea7838 ]
> 
> The description of PDU1 format usage mistakenly referred to PDU2
> format.

I'm pretty sure this does not fix user-visible bug.

BR,
								Pavel

> Signed-off-by: Alexander Hölzl <alexander.hoelzl@gmx.net>
> Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
> Acked-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> Link: https://patch.msgid.link/20241023145257.82709-1-alexander.hoelzl@gmx.net
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  Documentation/networking/j1939.rst | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/networking/j1939.rst b/Documentation/networking/j1939.rst
> index 0a4b73b03b997..59f81ba411608 100644
> --- a/Documentation/networking/j1939.rst
> +++ b/Documentation/networking/j1939.rst
> @@ -83,7 +83,7 @@ format, the Group Extension is set in the PS-field.
>  
>  On the other hand, when using PDU1 format, the PS-field contains a so-called
>  Destination Address, which is _not_ part of the PGN. When communicating a PGN
> -from user space to kernel (or vice versa) and PDU2 format is used, the PS-field
> +from user space to kernel (or vice versa) and PDU1 format is used, the PS-field
>  of the PGN shall be set to zero. The Destination Address shall be set
>  elsewhere.
>  

-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH AUTOSEL 5.10 4/6] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()
  2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 4/6] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
@ 2024-12-02 12:01   ` Pavel Machek
  0 siblings, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2024-12-02 12:01 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Luo Yifan, Mark Brown, olivier.moysan,
	arnaud.pouliquen, lgirdwood, perex, tiwai, mcoquelin.stm32,
	alexandre.torgue, alsa-devel, linux-sound, linux-stm32,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 1400 bytes --]

Hi!

> [ Upstream commit 63c1c87993e0e5bb11bced3d8224446a2bc62338 ]
> 
> This patch checks if div is less than or equal to zero (div <= 0). If
> div is zero or negative, the function returns -EINVAL, ensuring the
> division operation (*prate / div) is safe to perform.

Well, previous version propagated error code, now it is eaten. Is
stm32_sai_get_clk_div returning 0?

BR,
								Pavel

> Signed-off-by: Luo Yifan <luoyifan@cmss.chinamobile.com>
> Link: https://patch.msgid.link/20241106014654.206860-1-luoyifan@cmss.chinamobile.com
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  sound/soc/stm/stm32_sai_sub.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
> index 3aa1cf2624020..3a7f0102b4c5c 100644
> --- a/sound/soc/stm/stm32_sai_sub.c
> +++ b/sound/soc/stm/stm32_sai_sub.c
> @@ -380,8 +380,8 @@ static long stm32_sai_mclk_round_rate(struct clk_hw *hw, unsigned long rate,
>  	int div;
>  
>  	div = stm32_sai_get_clk_div(sai, *prate, rate);
> -	if (div < 0)
> -		return div;
> +	if (div <= 0)
> +		return -EINVAL;
>  
>  	mclk->freq = *prate / div;
>  

-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-02 12:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12 10:37 [PATCH AUTOSEL 5.10 1/6] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 2/6] regulator: rk808: Add apply_bit for BUCK3 on RK809 Sasha Levin
2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 3/6] can: j1939: fix error in J1939 documentation Sasha Levin
2024-12-02 11:59   ` Pavel Machek
2024-11-12 10:37 ` [PATCH AUTOSEL 5.10 4/6] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
2024-12-02 12:01   ` Pavel Machek
2024-11-12 10:38 ` [PATCH AUTOSEL 5.10 5/6] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin
2024-11-12 10:38 ` [PATCH AUTOSEL 5.10 6/6] proc/softirqs: replace seq_printf with seq_put_decimal_ull_width Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox