Netdev List
 help / color / mirror / Atom feed
* [PATCH] net/ulp: remove unnecessary assignment in tcp_register_ulp
@ 2024-07-01 11:42 Liu Jing
  2024-07-01 12:52 ` Michal Kubiak
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Jing @ 2024-07-01 11:42 UTC (permalink / raw)
  To: edumazet, davem, dsahern, kuba, pabeni; +Cc: netdev, linux-kernel, Liu Jing

in the tcp_register_ulp function, the initialized value of 'ret' is unused,
because it will be assigned a value by the -EEXIST.thus remove it.

Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
---
 net/ipv4/tcp_ulp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
index 2aa442128630..d11bde357e48 100644
--- a/net/ipv4/tcp_ulp.c
+++ b/net/ipv4/tcp_ulp.c
@@ -58,7 +58,7 @@ static const struct tcp_ulp_ops *__tcp_ulp_find_autoload(const char *name)
  */
 int tcp_register_ulp(struct tcp_ulp_ops *ulp)
 {
-	int ret = 0;
+	int ret;
 
 	spin_lock(&tcp_ulp_list_lock);
 	if (tcp_ulp_find(ulp->name))
-- 
2.33.0




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/ulp: remove unnecessary assignment in tcp_register_ulp
  2024-07-01 11:42 [PATCH] net/ulp: remove unnecessary assignment in tcp_register_ulp Liu Jing
@ 2024-07-01 12:52 ` Michal Kubiak
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Kubiak @ 2024-07-01 12:52 UTC (permalink / raw)
  To: Liu Jing; +Cc: edumazet, davem, dsahern, kuba, pabeni, netdev, linux-kernel

On Mon, Jul 01, 2024 at 07:42:40PM +0800, Liu Jing wrote:
> in the tcp_register_ulp function, the initialized value of 'ret' is unused,
> because it will be assigned a value by the -EEXIST.thus remove it.
> 
> Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
> ---
>  net/ipv4/tcp_ulp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
> index 2aa442128630..d11bde357e48 100644
> --- a/net/ipv4/tcp_ulp.c
> +++ b/net/ipv4/tcp_ulp.c
> @@ -58,7 +58,7 @@ static const struct tcp_ulp_ops *__tcp_ulp_find_autoload(const char *name)
>   */
>  int tcp_register_ulp(struct tcp_ulp_ops *ulp)
>  {
> -	int ret = 0;
> +	int ret;
>  
>  	spin_lock(&tcp_ulp_list_lock);
>  	if (tcp_ulp_find(ulp->name))
> -- 
> 2.33.0
> 
> 

As far as I understand the implementation of 'tcp_register_ulp', the only
case when -EEXIST value will be assigned to 'ret' is when
'tcp_ulp_find()' returns true.
In all other cases the return value should be zero.

According to my understanding, uninitialized return value has been
introduced in this patch which is not correct.

Thanks,
Nacked-by: Michal Kubiak <michal.kubiak@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-07-01 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 11:42 [PATCH] net/ulp: remove unnecessary assignment in tcp_register_ulp Liu Jing
2024-07-01 12:52 ` Michal Kubiak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox