[PATCH net-next] devlink: Fix error return code in devlink_health_buffer_prepare_skb()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix to return a negative error code -EMSGSIZE from the error handling
case, otherwise 0 or uninitialized value may be returned.

Fixes: cb5ccfbe73b3 ("devlink: Add health buffer support")
Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
---
 net/core/devlink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index 60248a5..0d4c774 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -4008,8 +4008,10 @@ void devlink_health_buffer_nest_cancel(struct devlink_health_buffer *buffer)
 		case DEVLINK_ATTR_HEALTH_BUFFER_OBJECT_VALUE:
 		case DEVLINK_ATTR_HEALTH_BUFFER_OBJECT_VALUE_ARRAY:
 			buffer_nlattr[i] = nla_nest_start(skb, desc->attrtype);
-			if (!buffer_nlattr[i])
+			if (!buffer_nlattr[i]) {
+				err = -EMSGSIZE;
 				goto nla_put_failure;
+			}
 			i++;
 			break;
 		case DEVLINK_ATTR_HEALTH_BUFFER_OBJECT_VALUE_DATA:






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux