2018-07-25 15:24:12

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH] rds: send: Fix dead code in rds_sendmsg

Currently, code at label *out* is unreachable. Fix this by updating
variable *ret* with -EINVAL, so the jump to *out* can be properly
executed instead of directly returning from function.

Addresses-Coverity-ID: 1472059 ("Structurally dead code")
Fixes: 1e2b44e78eea ("rds: Enable RDS IPv6 support")
Signed-off-by: Gustavo A. R. Silva <[email protected]>
---
net/rds/send.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rds/send.c b/net/rds/send.c
index 9604e1f..18e2b4d 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -1126,7 +1126,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
if (addr4 == htonl(INADDR_ANY) ||
addr4 == htonl(INADDR_BROADCAST) ||
IN_MULTICAST(ntohl(addr4))) {
- return -EINVAL;
+ ret = -EINVAL;
goto out;
}
}
--
2.7.4



2018-07-25 15:29:29

by Sowmini Varadhan

[permalink] [raw]
Subject: Re: [PATCH] rds: send: Fix dead code in rds_sendmsg

On (07/25/18 10:22), Gustavo A. R. Silva wrote:
> Currently, code at label *out* is unreachable. Fix this by updating
> variable *ret* with -EINVAL, so the jump to *out* can be properly
> executed instead of directly returning from function.
>
> Addresses-Coverity-ID: 1472059 ("Structurally dead code")
> Fixes: 1e2b44e78eea ("rds: Enable RDS IPv6 support")
> Signed-off-by: Gustavo A. R. Silva <[email protected]>

Acked-by: Sowmini Varadhan <[email protected]>

2018-07-25 16:54:11

by Santosh Shilimkar

[permalink] [raw]
Subject: Re: [PATCH] rds: send: Fix dead code in rds_sendmsg

On 7/25/2018 8:22 AM, Gustavo A. R. Silva wrote:
> Currently, code at label *out* is unreachable. Fix this by updating
> variable *ret* with -EINVAL, so the jump to *out* can be properly
> executed instead of directly returning from function.
>
> Addresses-Coverity-ID: 1472059 ("Structurally dead code")
> Fixes: 1e2b44e78eea ("rds: Enable RDS IPv6 support")
> Signed-off-by: Gustavo A. R. Silva <[email protected]>
> ---
Looks fine.
Acked-by: Santosh Shilimkar <[email protected]>

2018-07-26 05:39:26

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] rds: send: Fix dead code in rds_sendmsg

From: "Gustavo A. R. Silva" <[email protected]>
Date: Wed, 25 Jul 2018 10:22:27 -0500

> Currently, code at label *out* is unreachable. Fix this by updating
> variable *ret* with -EINVAL, so the jump to *out* can be properly
> executed instead of directly returning from function.
>
> Addresses-Coverity-ID: 1472059 ("Structurally dead code")
> Fixes: 1e2b44e78eea ("rds: Enable RDS IPv6 support")
> Signed-off-by: Gustavo A. R. Silva <[email protected]>

Applied.