* [PATCH] efi/apple-properties: Delete an error message for a failed memory allocation in unmarshal_devices()
@ 2018-02-13 17:00 SF Markus Elfring
2018-02-13 18:40 ` Lukas Wunner
0 siblings, 1 reply; 4+ messages in thread
From: SF Markus Elfring @ 2018-02-13 17:00 UTC (permalink / raw)
To: linux-efi, Ard Biesheuvel; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 13 Feb 2018 17:52:10 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/firmware/efi/apple-properties.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c
index 9f6bcf173b0e..f5f3159df4d5 100644
--- a/drivers/firmware/efi/apple-properties.c
+++ b/drivers/firmware/efi/apple-properties.c
@@ -158,10 +158,8 @@ static int __init unmarshal_devices(struct properties_header *properties)
entry = kcalloc(dev_header->prop_count + 1, sizeof(*entry),
GFP_KERNEL);
- if (!entry) {
- dev_err(dev, "cannot allocate properties\n");
+ if (!entry)
goto skip_device;
- }
unmarshal_key_value_pairs(dev_header, dev, ptr, entry);
if (!entry[0].name)
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] efi/apple-properties: Delete an error message for a failed memory allocation in unmarshal_devices()
2018-02-13 17:00 [PATCH] efi/apple-properties: Delete an error message for a failed memory allocation in unmarshal_devices() SF Markus Elfring
@ 2018-02-13 18:40 ` Lukas Wunner
2018-02-13 18:50 ` Joe Perches
2018-02-14 8:21 ` efi/apple-properties: Checking error handling " SF Markus Elfring
0 siblings, 2 replies; 4+ messages in thread
From: Lukas Wunner @ 2018-02-13 18:40 UTC (permalink / raw)
To: SF Markus Elfring; +Cc: linux-efi, Ard Biesheuvel, LKML, kernel-janitors
On Tue, Feb 13, 2018 at 06:00:26PM +0100, SF Markus Elfring wrote:
> Omit an extra message for a memory allocation failure in this function.
[snip]
> --- a/drivers/firmware/efi/apple-properties.c
> +++ b/drivers/firmware/efi/apple-properties.c
> @@ -158,10 +158,8 @@ static int __init unmarshal_devices(struct properties_header *properties)
>
> entry = kcalloc(dev_header->prop_count + 1, sizeof(*entry),
> GFP_KERNEL);
> - if (!entry) {
> - dev_err(dev, "cannot allocate properties\n");
> + if (!entry)
> goto skip_device;
> - }
>
> unmarshal_key_value_pairs(dev_header, dev, ptr, entry);
> if (!entry[0].name)
While the allocator does print an error when allocations fail,
it may not be immediately apparent to the user what the
*consequences* are. In this case, the consequence is that the
device properties will not be available for consumption by
drivers and they may fail to probe or behave in entirely
unexpected ways. Hence I deliberately printed an error message
here so that the user can make the connection between erratic
behavior of drivers later on and the memory allocation error here.
You didn't cc me on your submission even though I'm the author of
99% of this file. Please make an effort prior to submission to
identify interested parties.
Lukas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] efi/apple-properties: Delete an error message for a failed memory allocation in unmarshal_devices()
2018-02-13 18:40 ` Lukas Wunner
@ 2018-02-13 18:50 ` Joe Perches
2018-02-14 8:21 ` efi/apple-properties: Checking error handling " SF Markus Elfring
1 sibling, 0 replies; 4+ messages in thread
From: Joe Perches @ 2018-02-13 18:50 UTC (permalink / raw)
To: Lukas Wunner, SF Markus Elfring
Cc: linux-efi, Ard Biesheuvel, LKML, kernel-janitors
On Tue, 2018-02-13 at 19:40 +0100, Lukas Wunner wrote:
> On Tue, Feb 13, 2018 at 06:00:26PM +0100, SF Markus Elfring wrote:
> > --- a/drivers/firmware/efi/apple-properties.c
> You didn't cc me on your submission even though I'm the author of
> 99% of this file. Please make an effort prior to submission to
> identify interested parties.
If you want to receive patches for this file, even
if you are not a maintainer or an upstream path,
you should add yourself as a reviewer to the
MAINTAINERS file like:
APPLE EFI PROPERTIES
R: Lukas Wunner <lukas@wunner.de>
F: drivers/firmware/efi/apple-properties.c
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: efi/apple-properties: Checking error handling in unmarshal_devices()
2018-02-13 18:40 ` Lukas Wunner
2018-02-13 18:50 ` Joe Perches
@ 2018-02-14 8:21 ` SF Markus Elfring
1 sibling, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2018-02-14 8:21 UTC (permalink / raw)
To: Lukas Wunner, linux-efi; +Cc: Ard Biesheuvel, LKML, kernel-janitors
> While the allocator does print an error when allocations fail,
> it may not be immediately apparent to the user what the
> *consequences* are. In this case, the consequence is that the
> device properties will not be available for consumption by
> drivers and they may fail to probe or behave in entirely
> unexpected ways.
Would it make sense to indicate such a questionable software situation
be any return code?
> Hence I deliberately printed an error message here so that the user
> can make the connection between erratic behavior of drivers later on
> and the memory allocation error here.
Do you find this terse message really sufficient?
Can the mentioned properties be required for the desired system configuration?
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-14 8:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-13 17:00 [PATCH] efi/apple-properties: Delete an error message for a failed memory allocation in unmarshal_devices() SF Markus Elfring
2018-02-13 18:40 ` Lukas Wunner
2018-02-13 18:50 ` Joe Perches
2018-02-14 8:21 ` efi/apple-properties: Checking error handling " SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).