Skip to contentSkip to conversation

block/ps3vram: Delete an error message for a failed memory allocation in ps3vram_cache_init()

PATCH NAK SF Markus Elfring 4 participants 11 messages Aug 7, 2017 – Aug 8, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/ps3vram: Delete an error message for a failed memory allocation in ps3vram_cache_init()

From: Markus Elfring <[email protected]>
Date: Mon, 7 Aug 2017 12:37:01 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

---
 drivers/block/ps3vram.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/block/ps3vram.c +1 -3
index e0e81cacd781..ba97d037279e 100644
@@ -409,10 +409,8 @@ static int ps3vram_cache_init(struct ps3_system_bus_device *dev)
 	priv->cache.page_size = CACHE_PAGE_SIZE;
 	priv->cache.tags = kzalloc(sizeof(struct ps3vram_tag) *
 				   CACHE_PAGE_COUNT, GFP_KERNEL);
-	if (priv->cache.tags = NULL) {
-		dev_err(&dev->core, "Could not allocate cache tags\n");
+	if (!priv->cache.tags)
 		return -ENOMEM;
-	}
 
 	dev_info(&dev->core, "Created ram cache: %d entries, %d KiB each\n",
 		CACHE_PAGE_COUNT, CACHE_PAGE_SIZE / 1024);
Signature · 1 line
2.13.4
maintainer NAK
#1 lore raw
Quoted 6 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Mon, 7 Aug 2017 12:37:01 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

NACK

When a user asks me for help I would certainly like to get 'Could not allocate cache tags' as apposed to nothing, since the return value of ps3vram_cache_init() is not checked.

If you want to make an improvement please add a check for success of ps3vram_cache_init() in ps3vram_probe().

-Geoff

#2 lore raw
Quoted 7 lines · Geoff Levand
Quoted 1 line · SF Markus Elfring

Omit an extra message for a memory allocation failure in this function.

NACK

When a user asks me for help I would certainly like to get 'Could not allocate cache tags' as apposed to nothing, since the return value of ps3vram_cache_init() is not checked.

You still get a dump_stack on alloc failure.

#3 lore raw
In reply to Geoff Levand
Quoted 8 lines
Quoted 3 lines

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

NACK

When a user asks me for help I would certainly like to get 'Could not allocate cache tags' as apposed to nothing,

Do you find the default allocation failure report insufficient?

Quoted 1 line

since the return value of ps3vram_cache_init() is not checked.

Are there any more update candidates to consider for better exception handling?

Regards,
Markus

maintainer
#4 lore raw
Quoted 10 lines · SF Markus Elfring
Quoted 8 lines
Quoted 3 lines

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

NACK

When a user asks me for help I would certainly like to get 'Could not allocate cache tags' as apposed to nothing,

Do you find the default allocation failure report insufficient?

The default is OK. I didn't consider one would be triggered by the kzalloc failure.

Quoted 3 lines
Quoted 1 line

since the return value of ps3vram_cache_init() is not checked.

Are there any more update candidates to consider for better exception handling?

The return of ps3vram_cache_init() should be checked. Feel free to propose others.

-Geoff

#5 lore raw
Quoted 3 lines
Quoted 1 line

Do you find the default allocation failure report insufficient?

The default is OK.

Thanks for this information.

Quoted 1 line

I didn't consider one would be triggered by the kzalloc failure.

Do you reconsider any special system settings for further software evolution then?

Regards,
Markus

maintainer
#6 lore raw
Quoted 4 lines · SF Markus Elfring
Quoted 1 line

I didn't consider one would be triggered by the kzalloc failure.

Do you reconsider any special system settings for further software evolution then?

Sorry, I don't quite understand your question.

I think your original patch is OK, and I would appreciate if you added a check for failure of ps3vram_cache_init() in ps3vram_probe(). If you decide not to add that check I'll create a patch for it later.

If this doesn't answer your question, could you please rephrase it?

-Geoff

#7 lore raw
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I didn't consider one would be triggered by the kzalloc failure.

Do you reconsider any special system settings for further software evolution then?

Sorry, I don't quite understand your question.

Do you try to configure the Linux error reporting to any special needs?

Quoted 1 line

I think your original patch is OK,

How does this feedback fit to the initial response “Not Applicable”?
https://patchwork.ozlabs.org/patch/798575/

Quoted 2 lines

and I would appreciate if you added a check for failure of ps3vram_cache_init() in ps3vram_probe().

I unsure if this adjustment will need more software updates.

Quoted 1 line

If you decide not to add that check I'll create a patch for it later.

I am curious on who will pick this update candidate up as the next improvement. Have you got any preferences for the exception handling there?

Regards,
Markus

maintainer
#8 lore raw
Quoted 4 lines · SF Markus Elfring
Quoted 1 line

I think your original patch is OK,

How does this feedback fit to the initial response “Not Applicable”?
https://patchwork.ozlabs.org/patch/798575/

I submitted your patch and a fix to ps3vram_probe() with the other patches in my queue. Thanks for your contribution.

-Geoff

#9 lore raw
Quoted 3 lines
Quoted 1 line

https://patchwork.ozlabs.org/patch/798575/

I submitted your patch

Thanks for your constructive feedback.
https://patchwork.ozlabs.org/patch/798850/

Quoted 1 line

and a fix to ps3vram_probe() with the other patches in my queue.

I find it nice that you picked this change opportunity up after a bit of discussion (before an other developer would eventually have tackled it also).

“Check return of ps3vram_cache_init”
https://patchwork.ozlabs.org/patch/798853/

1. Unfortunately, I find that this specific update suggestion does not fit to the Linux coding style convention.

“…
Do not unnecessarily use braces where a single statement will do. …”

2. How do you think about to use the check “if (error)” instead?

3. Will an additional commit description be useful?

Regards,
Markus

#10 lore raw
In reply to SF Markus Elfring
Quoted 7 lines · SF Markus Elfring
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I didn't consider one would be triggered by the kzalloc failure.

Do you reconsider any special system settings for further software evolution then?

Sorry, I don't quite understand your question.

Quoted 7 lines

Do you try to configure the Linux error reporting to any special needs?

Quoted 1 line

I think your original patch is OK,

How does this feedback fit to the initial response “Not Applicable”?
https://patchwork.ozlabs.org/patch/798575/

That comes from me, and means "I can't apply this patch", because it's not a powerpc patch.

Looking at the maintainers output though maybe that is meant to go via the powerpc tree.

cheers