bonding: Delete an error message for a failed memory allocation in bond_update_slave_arr()
Subsystems (4)
PATCH 1/1 bonding: Delete an error message for a failed memory allocation in bond_update_slave_arr()
From: Markus Elfring <[email protected]>
Date: Mon, 1 Jan 2018 17:00:04 +0100
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
--- drivers/net/bonding/bond_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/bonding/bond_main.c +0 -1
@@ -3910,7 +3910,6 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave) GFP_KERNEL);if (!new_arr) { ret = -ENOMEM ; -pr_err ("Failed to build slave-array.\n" ); goto out; }if (BOND_MODE (bond) =BOND_MODE_8023AD ) {
Signature · 1 line
2.15.1
Quoted 7 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Mon, 1 Jan 2018 17:00:04 +0100Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
What is the issue with this message?
Quoted 20 lines
Signed-off-by Markus Elfring <[email protected]>--- drivers/net/bonding/bond_main.c | 1 - 1 file changed, 1 deletion(-)drivers/net/bonding/bond_main.c +0
-2@@ -3910,7 +3910,6 @@ int bond_update_slave_arr(struct bonding *bond, struct slave *skipslave) GFP_KERNEL);if (!new_arr) { ret = -ENOMEM ; -pr_err ("Failed to build slave-array.\n" ); goto out; }if (BOND_MODE (bond) =BOND_MODE_8023AD ) { --2.15.1
Quoted 5 lines
Quoted 4 lines
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
What is the issue with this message?
* Is it redundant?
* Would a Linux allocation failure report be already sufficient here?
Regards,
Markus
Quoted 10 lines · SF Markus Elfring
Quoted 5 lines
Quoted 4 lines
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
What is the issue with this message?
* Is it redundant?
* Would a Linux allocation failure report be already sufficient here?
If you see 8 out of 9 call sites in this file ignore the return value. This message in the log could give a clue when debugging. Unless it's spamming it's not harmful, or is it?
Quoted 2 lines
Regards,
Markus
Quoted 9 lines · Mahesh Bandewar (महेश बंडेवार)
Quoted 7 lines · SF Markus Elfring
Quoted 6 lines
Quoted 4 lines
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
What is the issue with this message?
Quoted 8 lines
Quoted 4 lines
* Is it redundant?
* Would a Linux allocation failure report be already sufficient here?
If you see 8 out of 9 call sites in this file ignore the return value. This message in the log could give a clue when debugging. Unless it's spamming it's not harmful, or is it?
A failed kzalloc() would already give a complete stack trace.
Really the pr_err() adds no value here.
Re: bonding: Completion of error handling around bond_update_slave_arr()
In reply to Mahesh Bandewar (महेश बंडेवार)Quoted 1 line
If you see 8 out of 9 call sites in this file ignore the return value.
How do you think about to fix error detection and corresponding exception handling then?
Regards,
Markus
Re: bonding: Completion of error handling around bond_update_slave_arr()
Quoted 5 lines · SF Markus Elfring
Quoted 1 line
If you see 8 out of 9 call sites in this file ignore the return value.
How do you think about to fix error detection and corresponding exception handling then?
If I understand your question correctly - not having memory is not a correctable error and hence there are consequences. In this case, the slave_arr is not going to be rebuilt and this might mean loosing packets (if the interface was dropped) or not using the interface to send packets if that was added (very unlikely case). From host's perspective, however, this might be the last thing you want to worry about when there is no memory left.
Quoted 2 lines
Regards,
Markus
Re: bonding: Completion of error handling around bond_update_slave_arr()
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
If you see 8 out of 9 call sites in this file ignore the return value.
How do you think about to fix error detection and corresponding exception handling then?
If I understand your question correctly - not having memory is not a correctable error
I am unsure if it would be feasible to retry memory allocations for this software module under other circumstances.
Quoted 1 line
and hence there are consequences.
Could one consequence be to let the error code “-ENOMEM” move through the function call hierarchy?
Regards,
Markus