fpga: dfl: fme: Return directly after a failed devm_kasprintf() call in fme_perf_pmu_register()
Subsystems (4)
PATCH 1/1 fpga: dfl: fme: Return directly after a failed devm_kasprintf() call in fme_perf_pmu_register()
From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2024 15:43:42 +0100
The result from a call of the function “devm_kasprintf” was passed to a subsequent function call without checking for a null pointer before (according to a memory allocation failure).
This issue was detected by using the Coccinelle software.
Thus return directly after a failed devm_kasprintf() call.
--- drivers/fpga/dfl-fme-perf.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/fpga/dfl-fme-perf.c +2 -0
@@ -925,6 +925,8 @@ static int fme_perf_pmu_register(struct platform_device *pdev,PERF_PMU_CAP_NO_EXCLUDE ; name =devm_kasprintf (priv->dev,GFP_KERNEL ,"dfl_fme%d" , pdev->id); +if (!name) +return -ENOMEM ; ret =perf_pmu_register (pmu, name,-1 );if (ret)
--
2.43.0
Quoted 8 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2024 15:43:42 +0100The result from a call of the function “devm_kasprintf” was passed to a subsequent function call without checking for a null pointer before (according to a memory allocation failure).
This issue was detected by using the Coccinelle software.
Quoted 4 lines
Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")Signed-off-by Markus Elfring <[email protected]>
Quoted 21 lines
--- drivers/fpga/dfl-fme-perf.c | 2 ++ 1 file changed, 2 insertions(+)drivers/fpga/dfl-fme-perf.c +2
-1@@ -925,6 +925,8 @@ static int fme_perf_pmu_register(struct platform_device *pdev,PERF_PMU_CAP_NO_EXCLUDE ; name =devm_kasprintf (priv->dev,GFP_KERNEL ,"dfl_fme%d" , pdev->id); +if (!name) +return -ENOMEM ; ret =perf_pmu_register (pmu, name,-1 );if (ret) --2.43.0
Quoted 3 lines · Xu Yilun
Quoted 2 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2024 15:43:42 +0100
Sorry, something to fix.
Please shorten your shortlog to less than 75 chars. Please refer to Documentation/process/submitting-patches.rst
Quoted 9 lines
Quoted 9 lines
The result from a call of the function “devm_kasprintf” was passed to a subsequent function call without checking for a null pointer before (according to a memory allocation failure).
This issue was detected by using the Coccinelle software.Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")
One more char of sha.
Please use checkpatch to verify.
Thanks,
Yilun
Quoted 26 lines
Quoted 1 line
Signed-off-by Markus Elfring <[email protected]>Acked-by Xu Yilun <[email protected]>Quoted 21 lines
--- drivers/fpga/dfl-fme-perf.c | 2 ++ 1 file changed, 2 insertions(+)drivers/fpga/dfl-fme-perf.c +2
-1@@ -925,6 +925,8 @@ static int fme_perf_pmu_register(struct platform_device *pdev,PERF_PMU_CAP_NO_EXCLUDE ; name =devm_kasprintf (priv->dev,GFP_KERNEL ,"dfl_fme%d" , pdev->id); +if (!name) +return -ENOMEM ; ret =perf_pmu_register (pmu, name,-1 );if (ret) --2.43.0
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")One more char of sha.
There are different preferences involved.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.8-rc2#n109
Regards,
Markus
Quoted 8 lines · Markus Elfring
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")One more char of sha.
There are different preferences involved.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.8-rc2#n109
Ah, I mean you use 13 chars, but 12 chars is better. Also the doc doens't seem to enforce 12 chars, but checkpatch warns on that. So just follow the 12 chars style.
Thanks,
Yilun
Quoted 3 lines
Regards,
Markus
Quoted 5 lines
Quoted 2 lines
There are different preferences involved.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.8-rc2#n109Ah, I mean you use 13 chars, but 12 chars is better. Also the doc doens't seem to enforce 12 chars, but checkpatch warns on that.
Would the specification “at least” become supported at further places for such hash lengths?
Regards,
Markus
Quoted 18 lines · Xu Yilun
Quoted 3 lines · Xu Yilun
Quoted 2 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2024 15:43:42 +0100Sorry, something to fix.
Please shorten your shortlog to less than 75 chars. Please refer to
Documentation/process/submitting-patches.rstQuoted 8 lines
Quoted 8 lines
The result from a call of the function “devm_kasprintf” was passed to a subsequent function call without checking for a null pointer before (according to a memory allocation failure).
This issue was detected by using the Coccinelle software.Thus return directly after a failed
devm_kasprintf()call.
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")One more char of sha.
Please use checkpatch to verify.
Thanks,
Yilun
Hi,
This is the semi-friendly patch-bot of Greg Kroah-Hartman.
Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time.
Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them.
thanks,
greg k-h's patch email bot
Quoted 11 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 27 Jan 2024 15:43:42 +0100The result from a call of the function “devm_kasprintf” was passed to a subsequent function call without checking for a null pointer before (according to a memory allocation failure).
This issue was detected by using the Coccinelle software.Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")
This basically doesn't affect runtime because perf_pmu_register() checks for NULL so no need for a Fixes tag.
regards,
dan carpenter
Quoted 6 lines
Quoted 3 lines
Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")This basically doesn't affect runtime because
perf_pmu_register()checks for NULL so no need for a Fixes tag.
I suggest to clarify this view a bit more also according to statements like the following.
1. https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11532
perf_pmu_register:
…
pmu->name = name;
…
2. https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11472
pmu_dev_alloc:
…
ret = dev_set_name(pmu->dev, "%s", pmu->name);
…
Regards,
Markus
Quoted 18 lines · Markus Elfring
Quoted 6 lines
Quoted 3 lines
Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")This basically doesn't affect runtime because
perf_pmu_register()checks for NULL so no need for a Fixes tag.I suggest to clarify this view a bit more also according to statements like the following.
1. https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11532
perf_pmu_register:… pmu->name = name; …2. https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11472
pmu_dev_alloc:
Quoted 7 lines
… ret = dev_set_name(pmu->dev, "%s", pmu->name); …Regards,
Markus
Hi,
This is the semi-friendly patch-bot of Greg Kroah-Hartman.
Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time.
thanks,
greg k-h's patch email bot
Quoted 7 lines · Markus Elfring
Quoted 6 lines
Quoted 3 lines
Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")This basically doesn't affect runtime because
perf_pmu_register()checks for NULL so no need for a Fixes tag.
Quoted 8 lines
I suggest to clarify this view a bit more also according to statements like the following.
1. https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11532
perf_pmu_register:… pmu->name = name; …
The check is right before that on line 11527.
https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11527
regards,
dan carpenter
Quoted 3 lines
The check is right before that on line 11527.
https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11527
Do you find a warning message like “Can not register anonymous pmu.” acceptable in addition to eventual other indications for memory allocation failures so far?
Regards,
Markus
Quoted 5 lines
Quoted 3 lines
Thus return directly after a failed
devm_kasprintf()call.Fixes 724142f8c42a7 ("fpga: dfl: fme: add performance reporting support")This basically doesn't affect runtime because
perf_pmu_register()checks for NULL
https://elixir.bootlin.com/linux/v6.8-rc2/source/kernel/events/core.c#L11527
Do you prefer the usage of the error code “-ENOMEM” instead of “-EINVAL” as an indication for a failed memory allocation?
Quoted 1 line
so no need for a Fixes tag.
Does the selection of a more appropriate error code qualify for this tag?
Regards,
Markus