soc: qcom: Add check devm_kasprintf() returned value
Subsystems (8)
Sasha Levin
maintainerPATCH 1/6 soc: qcom: Add check devm_kasprintf() returned value
From: Charles Han <[email protected]>
[ Upstream commit e694d2b5c58ba2d1e995d068707c8d966e7f5f2a ]
devm_kasprintf() can return a NULL pointer on failure but this returned value in qcom_socinfo_probe() is not checked.
--- drivers/soc/qcom/socinfo.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/soc/qcom/socinfo.c +7 -1
@@ -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))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/6 regulator: rk808: Add apply_bit for BUCK3 on RK809
From: Mikhail Rudenko <[email protected]>
[ 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.
--- drivers/regulator/rk808-regulator.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/rk808-regulator.c +2 -0
@@ -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),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/6 can: j1939: fix error in J1939 documentation.
In reply to Sasha LevinFrom: Alexander Hölzl <[email protected]>
[ Upstream commit b6ec62e01aa4229bc9d3861d1073806767ea7838 ]
The description of PDU1 format usage mistakenly referred to PDU2 format.
--- Documentation/networking/j1939.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/networking/j1939.rst +1 -1
@@ -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.
Signature · 1 line
2.43.0
Re: [PATCH AUTOSEL 5.10 3/6] can: j1939: fix error in J1939 documentation.
Hi!
Quoted 6 lines
From: Alexander Hölzl <[email protected]>
[ 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
Quoted 23 lines
Signed-off-by Alexander Hölzl <[email protected]>Acked-by Oleksij Rempel <[email protected]>Acked-by Vincent Mailhol <[email protected]>Signed-off-by Marc Kleine-Budde <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- Documentation/networking/j1939.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Documentation/networking/j1939.rst +1
-1@@ -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.
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
Sasha Levin
maintainerPATCH 4/6 ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()
In reply to Sasha LevinFrom: Luo Yifan <[email protected]>
[ 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.
--- sound/soc/stm/stm32_sai_sub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/stm/stm32_sai_sub.c +2 -2
@@ -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;
Signature · 1 line
2.43.0
Re: [PATCH AUTOSEL 5.10 4/6] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate()
Hi!
Quoted 5 lines
[ 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
Quoted 23 lines
Signed-off-by Luo Yifan <[email protected]>Signed-off-by Mark Brown <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- sound/soc/stm/stm32_sai_sub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/stm/stm32_sai_sub.c +2
-2@@ -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;
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Sasha Levin
maintainerPATCH 5/6 ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()
In reply to Sasha LevinFrom: Luo Yifan <[email protected]>
[ 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.
--- sound/soc/stm/stm32_sai_sub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/stm/stm32_sai_sub.c +1 -1
@@ -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 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/6 proc/softirqs: replace seq_printf with seq_put_decimal_ull_width
In reply to Sasha LevinFrom: David Wang <[email protected]>
[ 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.
--- fs/proc/softirqs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/softirqs.c +1 -1
@@ -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 ;
Signature · 1 line
2.43.0