diff mbox series

[net-next] net: qrtr: ns: Fix error return code in qrtr_ns_init()

Message ID 20210519141621.3044684-1-weiyongjun1@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: qrtr: ns: Fix error return code in qrtr_ns_init() | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 60 this patch: 60
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 60 this patch: 60
netdev/header_inline success Link

Commit Message

Wei Yongjun May 19, 2021, 2:16 p.m. UTC
Fix to return a negative error code -ENOMEM from the error handling
case instead of 0, as done elsewhere in this function.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 net/qrtr/ns.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Manivannan Sadhasivam May 19, 2021, 2:15 p.m. UTC | #1
On Wed, May 19, 2021 at 02:16:21PM +0000, Wei Yongjun wrote:
> Fix to return a negative error code -ENOMEM from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  net/qrtr/ns.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
> index 8d00dfe8139e..1990d496fcfc 100644
> --- a/net/qrtr/ns.c
> +++ b/net/qrtr/ns.c
> @@ -775,8 +775,10 @@ int qrtr_ns_init(void)
>  	}
>  
>  	qrtr_ns.workqueue = alloc_workqueue("qrtr_ns_handler", WQ_UNBOUND, 1);
> -	if (!qrtr_ns.workqueue)
> +	if (!qrtr_ns.workqueue) {
> +		ret = -ENOMEM;
>  		goto err_sock;
> +	}
>  
>  	qrtr_ns.sock->sk->sk_data_ready = qrtr_ns_data_ready;
>  
>
Manivannan Sadhasivam May 19, 2021, 2:18 p.m. UTC | #2
On Wed, May 19, 2021 at 02:16:21PM +0000, Wei Yongjun wrote:
> Fix to return a negative error code -ENOMEM from the error handling
> case instead of 0, as done elsewhere in this function.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

You might want to add Fixes tag:

Fixes: c6e08d6251f3 ("net: qrtr: Allocate workqueue before kernel_bind")

Thanks,
Mani

> ---
>  net/qrtr/ns.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
> index 8d00dfe8139e..1990d496fcfc 100644
> --- a/net/qrtr/ns.c
> +++ b/net/qrtr/ns.c
> @@ -775,8 +775,10 @@ int qrtr_ns_init(void)
>  	}
>  
>  	qrtr_ns.workqueue = alloc_workqueue("qrtr_ns_handler", WQ_UNBOUND, 1);
> -	if (!qrtr_ns.workqueue)
> +	if (!qrtr_ns.workqueue) {
> +		ret = -ENOMEM;
>  		goto err_sock;
> +	}
>  
>  	qrtr_ns.sock->sk->sk_data_ready = qrtr_ns_data_ready;
>  
>
Wei Yongjun May 19, 2021, 3:26 p.m. UTC | #3
> On Wed, May 19, 2021 at 02:16:21PM +0000, Wei Yongjun wrote:
>> Fix to return a negative error code -ENOMEM from the error handling
>> case instead of 0, as done elsewhere in this function.
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> You might want to add Fixes tag:
>
> Fixes: c6e08d6251f3 ("net: qrtr: Allocate workqueue before kernel_bind")
>

Thanks, I will add fixes tag and send v2.

Regards,

Wei Yongjun
diff mbox series

Patch

diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c
index 8d00dfe8139e..1990d496fcfc 100644
--- a/net/qrtr/ns.c
+++ b/net/qrtr/ns.c
@@ -775,8 +775,10 @@  int qrtr_ns_init(void)
 	}
 
 	qrtr_ns.workqueue = alloc_workqueue("qrtr_ns_handler", WQ_UNBOUND, 1);
-	if (!qrtr_ns.workqueue)
+	if (!qrtr_ns.workqueue) {
+		ret = -ENOMEM;
 		goto err_sock;
+	}
 
 	qrtr_ns.sock->sk->sk_data_ready = qrtr_ns_data_ready;