Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1735574 > unrolled thread
| Started by | Arvind Yadav <arvind.yadav.cs@gmail.com> |
|---|---|
| First post | 2017-09-20 09:10 +0200 |
| Last post | 2017-09-20 19:00 +0200 |
| Articles | 4 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH] PM / OPP: Handle return value of kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-20 09:10 +0200
Re: [PATCH] PM / OPP: Handle return value of kasprintf Joe Perches <joe@perches.com> - 2017-09-20 13:20 +0200
Re: [PATCH] PM / OPP: Handle return value of kasprintf Viresh Kumar <viresh.kumar@linaro.org> - 2017-09-20 16:50 +0200
Re: [PATCH] PM / OPP: Handle return value of kasprintf arvind <arvind.yadav.cs@gmail.com> - 2017-09-20 19:00 +0200
| From | Arvind Yadav <arvind.yadav.cs@gmail.com> |
|---|---|
| Date | 2017-09-20 09:10 +0200 |
| Subject | [PATCH] PM / OPP: Handle return value of kasprintf |
| Message-ID | <urHiX-8bg-49@gated-at.bofh.it> |
kasprintf() can fail here and we must check its return value.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/base/power/opp/debugfs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
index 81cf120..226d6ae 100644
--- a/drivers/base/power/opp/debugfs.c
+++ b/drivers/base/power/opp/debugfs.c
@@ -45,7 +45,8 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
for (i = 0; i < opp_table->regulator_count; i++) {
name = kasprintf(GFP_KERNEL, "supply-%d", i);
-
+ if (!name)
+ return false;
/* Create per-opp directory */
d = debugfs_create_dir(name, pdentry);
--
1.9.1
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-09-20 13:20 +0200 |
| Message-ID | <urLcR-2iJ-13@gated-at.bofh.it> |
| In reply to | #1735574 |
On Wed, 2017-09-20 at 12:29 +0530, Arvind Yadav wrote:
> kasprintf() can fail here and we must check its return value.
[]
> diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
[]
> @@ -45,7 +45,8 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
>
> for (i = 0; i < opp_table->regulator_count; i++) {
> name = kasprintf(GFP_KERNEL, "supply-%d", i);
> -
> + if (!name)
> + return false;
> /* Create per-opp directory */
> d = debugfs_create_dir(name, pdentry);
Probably more sensible to avoid the kasprintf/kfree
and just have
char name[20];
on the stack
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2017-09-20 16:50 +0200 |
| Message-ID | <urOu6-4lW-23@gated-at.bofh.it> |
| In reply to | #1735723 |
On 20-09-17, 04:17, Joe Perches wrote:
> On Wed, 2017-09-20 at 12:29 +0530, Arvind Yadav wrote:
> > kasprintf() can fail here and we must check its return value.
> []
> > diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
> []
> > @@ -45,7 +45,8 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
> >
> > for (i = 0; i < opp_table->regulator_count; i++) {
> > name = kasprintf(GFP_KERNEL, "supply-%d", i);
> > -
> > + if (!name)
> > + return false;
> > /* Create per-opp directory */
> > d = debugfs_create_dir(name, pdentry);
>
> Probably more sensible to avoid the kasprintf/kfree
> and just have
> char name[20];
> on the stack
Sure.
@Arvind: I will let you write that patch.
--
viresh
[toc] | [prev] | [next] | [standalone]
| From | arvind <arvind.yadav.cs@gmail.com> |
|---|---|
| Date | 2017-09-20 19:00 +0200 |
| Message-ID | <urQvT-5Dp-3@gated-at.bofh.it> |
| In reply to | #1735805 |
Hi,
On Wednesday 20 September 2017 08:19 PM, Viresh Kumar wrote:
> On 20-09-17, 04:17, Joe Perches wrote:
>> On Wed, 2017-09-20 at 12:29 +0530, Arvind Yadav wrote:
>>> kasprintf() can fail here and we must check its return value.
>> []
>>> diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
>> []
>>> @@ -45,7 +45,8 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
>>>
>>> for (i = 0; i < opp_table->regulator_count; i++) {
>>> name = kasprintf(GFP_KERNEL, "supply-%d", i);
>>> -
>>> + if (!name)
>>> + return false;
>>> /* Create per-opp directory */
>>> d = debugfs_create_dir(name, pdentry);
>> Probably more sensible to avoid the kasprintf/kfree
>> and just have
>> char name[20];
>> on the stack
> Sure.
>
> @Arvind: I will let you write that patch.
Yes, I will do.
>
~arvind
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web