[PATCH net-next] rxrpc: Remove set but not used variable 'ioc'

Subsystems: networking [general], rxrpc sockets (af_rxrpc), the rest

STALE2890d

9 messages, 4 authors, 2018-10-12 · open the first message on its own page

[PATCH net-next] rxrpc: Remove set but not used variable 'ioc'

From: YueHaibing <hidden>
Date: 2018-10-09 09:34:37

Fixes gcc '-Wunused-but-set-variable' warning:

net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

It never used since introduction in
commit ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than ABORTs")

Signed-off-by: YueHaibing <redacted>
---
 net/rxrpc/output.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index e8fb892..f3ed16a 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -524,7 +524,7 @@ void rxrpc_reject_packets(struct rxrpc_local *local)
 	struct kvec iov[2];
 	size_t size;
 	__be32 code;
-	int ret, ioc;
+	int ret;
 
 	_enter("%d", local->debug_id);
 
@@ -548,13 +548,11 @@ void rxrpc_reject_packets(struct rxrpc_local *local)
 		case RXRPC_SKB_MARK_REJECT_BUSY:
 			whdr.type = RXRPC_PACKET_TYPE_BUSY;
 			size = sizeof(whdr);
-			ioc = 1;
 			break;
 		case RXRPC_SKB_MARK_REJECT_ABORT:
 			whdr.type = RXRPC_PACKET_TYPE_ABORT;
 			code = htonl(skb->priority);
 			size = sizeof(whdr) + sizeof(code);
-			ioc = 2;
 			break;
 		default:
 			rxrpc_free_skb(skb, rxrpc_skb_rx_freed);

Re: [PATCH net-next] rxrpc: Remove set but not used variable 'ioc'

From: David Howells <dhowells@redhat.com>
Date: 2018-10-09 17:29:35

YueHaibing [off-list ref] wrote:
net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

It never used since introduction in
I wonder why my compiler doesn't show this warning.

Anyway, NAK: just removing the variable is the wrong fix - you need to look at
the code more closely.  The actual fix is to pass it to kernel_sendmsg()
instead of 2.

But thanks anyway!  Do you want to respin your patch?
commit ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than ABORTs")
Btw, this should be a 'Fixes: <commit> ("subject")' line and the patch needs
to go to net, not net-next.

David

Re: [PATCH net-next] rxrpc: Remove set but not used variable 'ioc'

From: YueHaibing <hidden>
Date: 2018-10-09 19:20:58

On 2018/10/9 18:13, David Howells wrote:
YueHaibing [off-list ref] wrote:
quoted
net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

It never used since introduction in
I wonder why my compiler doesn't show this warning.
Just use make W=1
Anyway, NAK: just removing the variable is the wrong fix - you need to look at
the code more closely.  The actual fix is to pass it to kernel_sendmsg()
instead of 2.
I didn't notice this, Thank you for correction.
But thanks anyway!  Do you want to respin your patch?
Sure, I will fix it.
quoted
commit ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than ABORTs")
Btw, this should be a 'Fixes: <commit> ("subject")' line and the patch needs
to go to net, not net-next.

David

.

[PATCH v2] rxrpc: use correct kvec num while send response packet in rxrpc_reject_packets

From: YueHaibing <hidden>
Date: 2018-10-09 21:21:27

Fixes gcc '-Wunused-but-set-variable' warning:

net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

'ioc' is the correct kvec num while send response packet.

Fixes: commit ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than ABORTs")
Signed-off-by: YueHaibing <redacted>
---
 net/rxrpc/output.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index e8fb892..a141ee3 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -572,7 +572,8 @@ void rxrpc_reject_packets(struct rxrpc_local *local)
 			whdr.flags	^= RXRPC_CLIENT_INITIATED;
 			whdr.flags	&= RXRPC_CLIENT_INITIATED;
 
-			ret = kernel_sendmsg(local->socket, &msg, iov, 2, size);
+			ret = kernel_sendmsg(local->socket, &msg,
+					     iov, ioc, size);
 			if (ret < 0)
 				trace_rxrpc_tx_fail(local->debug_id, 0, ret,
 						    rxrpc_tx_point_reject);

Re: [PATCH v2] rxrpc: use correct kvec num while send response packet in rxrpc_reject_packets

From: Sergei Shtylyov <hidden>
Date: 2018-10-09 22:51:36

On 10/09/2018 05:15 PM, YueHaibing wrote:
Fixes gcc '-Wunused-but-set-variable' warning:

net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

'ioc' is the correct kvec num while send response packet.

Fixes: commit ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than 
ABORTs")

   "commit" not needed here.
Signed-off-by: YueHaibing <redacted>
[...]

MBR, Sergei

Re: [PATCH v2] rxrpc: use correct kvec num while send response packet in rxrpc_reject_packets

From: YueHaibing <hidden>
Date: 2018-10-10 08:39:03

On 2018/10/9 23:34, Sergei Shtylyov wrote:
On 10/09/2018 05:15 PM, YueHaibing wrote:
quoted
Fixes gcc '-Wunused-but-set-variable' warning:

net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

'ioc' is the correct kvec num while send response packet.

Fixes: commit ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than 
ABORTs")

   "commit" not needed here.
Thank you for review.
quoted
Signed-off-by: YueHaibing <redacted>
[...]

MBR, Sergei

[PATCH v3] rxrpc: use correct kvec num while send response packet in rxrpc_reject_packets

From: YueHaibing <hidden>
Date: 2018-10-10 09:14:58

Fixes gcc '-Wunused-but-set-variable' warning:

net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

'ioc' is the correct kvec num while send response packet.

Fixes: ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than ABORTs")
Signed-off-by: YueHaibing <redacted>
---
v3: remove 'commit' from Fixes info.
v2: use 'ioc' rather than remove it.
---
 net/rxrpc/output.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/rxrpc/output.c b/net/rxrpc/output.c
index e8fb892..a141ee3 100644
--- a/net/rxrpc/output.c
+++ b/net/rxrpc/output.c
@@ -572,7 +572,8 @@ void rxrpc_reject_packets(struct rxrpc_local *local)
 			whdr.flags	^= RXRPC_CLIENT_INITIATED;
 			whdr.flags	&= RXRPC_CLIENT_INITIATED;
 
-			ret = kernel_sendmsg(local->socket, &msg, iov, 2, size);
+			ret = kernel_sendmsg(local->socket, &msg,
+					     iov, ioc, size);
 			if (ret < 0)
 				trace_rxrpc_tx_fail(local->debug_id, 0, ret,
 						    rxrpc_tx_point_reject);

Re: [PATCH net-next] rxrpc: Remove set but not used variable 'ioc'

From: Dan Carpenter <hidden>
Date: 2018-10-11 16:04:51

On Tue, Oct 09, 2018 at 11:13:16AM +0100, David Howells wrote:
YueHaibing [off-list ref] wrote:
quoted
net/rxrpc/output.c: In function 'rxrpc_reject_packets':
net/rxrpc/output.c:527:11: warning:
 variable 'ioc' set but not used [-Wunused-but-set-variable]

It never used since introduction in
I wonder why my compiler doesn't show this warning.

Anyway, NAK: just removing the variable is the wrong fix - you need to look at
the code more closely.  The actual fix is to pass it to kernel_sendmsg()
instead of 2.

But thanks anyway!  Do you want to respin your patch?
quoted
commit ece64fec164f ("rxrpc: Emit BUSY packets when supposed to rather than ABORTs")
Btw, this should be a 'Fixes: <commit> ("subject")' line and the patch needs
to go to net, not net-next.
I told him to do that because it wasn't a bugfix...  Probably just Fixes
is the right thing to use though.

regards,
dan carpenter

Re: [PATCH net-next] rxrpc: Remove set but not used variable 'ioc'

From: David Howells <dhowells@redhat.com>
Date: 2018-10-12 04:07:41

Dan Carpenter [off-list ref] wrote:
I told him to do that because it wasn't a bugfix...  Probably just Fixes
is the right thing to use though.
But the correct fix *is* a bug fix.

David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help