net/smc: fixes for smc buffer handling
cover net/smc: fixes for smc buffer handling
Dave,
here are 2 cleanup patches for smc buffer handling.
Thanks, Ursula
Geert Uytterhoeven (1):
net/smc: Fix preinitialization of buf_desc in __smc_buf_create()
Ursula Braun (1):
net/smc: use sk_rcvbuf as start for rmb creation
net/smc/smc_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.13.5
PATCH 1/2 net/smc: use sk_rcvbuf as start for rmb creation
From: Ursula Braun <[email protected]>
Commit 3e034725c0d8 ("net/smc: common functions for RMBs and send buffers") merged handling of SMC receive and send buffers. It introduced sk_buf_size as merged start value for size determination. But since sk_buf_size is not used at all, sk_sndbuf is erroneously used as start for rmb creation. This patch makes sure, sk_buf_size is really used as intended, and sk_rcvbuf is used as start value for rmb creation.
--- net/smc/smc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_core.c +1 -1
@@ -575,7 +575,7 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_rmb)/* use socket send buffer size (w/o overhead) as start value */ sk_buf_size = smc->sk.sk_sndbuf /2 ; -for (bufsize_short =smc_compress_bufsize (smc->sk.sk_sndbuf /2 ); +for (bufsize_short =smc_compress_bufsize (sk_buf_size); bufsize_short >=0 ; bufsize_short--) {if (is_rmb) {
Signature · 1 line
2.13.5
PATCH 2/2 net/smc: Fix preinitialization of buf_desc in __smc_buf_create()
In reply to Ursula BraunFrom: Geert Uytterhoeven <[email protected]>
With gcc-4.1.2:
net/smc/smc_core.c: In function ‘__smc_buf_create’:
net/smc/smc_core.c:567: warning: ‘bufsize’ may be used uninitialized in this function
Indeed, if the for-loop is never executed, bufsize is used uninitialized. In addition, buf_desc is stored for later use, while it is still a NULL pointer.
Before, error handling was done by checking if buf_desc is non-NULL. The cleanup changed this to an error check, but forgot to update the preinitialization of buf_desc to an error pointer.
Update the preinitializatin of buf_desc to fix this.
--- net/smc/smc_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/smc/smc_core.c +1 -1
@@ -562,7 +562,7 @@ static int __smc_buf_create(struct smc_sock *smc, bool is_rmb) {struct smc_connection *conn = &smc->conn;struct smc_link_group *lgr = conn->lgr; -struct smc_buf_desc *buf_desc =NULL ; +struct smc_buf_desc *buf_desc =ERR_PTR (-ENOMEM );struct list_head *buf_list;int bufsize, bufsize_short;int sk_buf_size;
Signature · 1 line
2.13.5
David Miller
maintainerFrom: Ursula Braun <[email protected]>
Date: Tue, 21 Nov 2017 13:23:52 +0100
Quoted 1 line
here are 2 cleanup patches for smc buffer handling.
Series applied, thanks.