* [PATCH net 0/2] net/smc: fixes for smc buffer handling
@ 2017-11-21 12:23 Ursula Braun
2017-11-21 12:23 ` [PATCH net 1/2] net/smc: use sk_rcvbuf as start for rmb creation Ursula Braun
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ursula Braun @ 2017-11-21 12:23 UTC (permalink / raw)
To: davem
Cc: netdev, linux-s390, jwi, schwidefsky, heiko.carstens, raspl,
geert, ubraun
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(-)
--
2.13.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] net/smc: use sk_rcvbuf as start for rmb creation
2017-11-21 12:23 [PATCH net 0/2] net/smc: fixes for smc buffer handling Ursula Braun
@ 2017-11-21 12:23 ` Ursula Braun
2017-11-21 12:23 ` [PATCH net 2/2] net/smc: Fix preinitialization of buf_desc in __smc_buf_create() Ursula Braun
2017-11-23 16:34 ` [PATCH net 0/2] net/smc: fixes for smc buffer handling David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Ursula Braun @ 2017-11-21 12:23 UTC (permalink / raw)
To: davem
Cc: netdev, linux-s390, jwi, schwidefsky, heiko.carstens, raspl,
geert, ubraun
From: Ursula Braun <ursula.braun@de.ibm.com>
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.
Fixes: 3e034725c0d8 ("net/smc: common functions for RMBs and send buffers")
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Hans Wippel <hwippel@linux.vnet.ibm.com>
---
net/smc/smc_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 2578fbd95664..3b5e5d4bc763 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -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) {
--
2.13.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] net/smc: Fix preinitialization of buf_desc in __smc_buf_create()
2017-11-21 12:23 [PATCH net 0/2] net/smc: fixes for smc buffer handling Ursula Braun
2017-11-21 12:23 ` [PATCH net 1/2] net/smc: use sk_rcvbuf as start for rmb creation Ursula Braun
@ 2017-11-21 12:23 ` Ursula Braun
2017-11-23 16:34 ` [PATCH net 0/2] net/smc: fixes for smc buffer handling David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Ursula Braun @ 2017-11-21 12:23 UTC (permalink / raw)
To: davem
Cc: netdev, linux-s390, jwi, schwidefsky, heiko.carstens, raspl,
geert, ubraun
From: Geert Uytterhoeven <geert@linux-m68k.org>
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.
Fixes: b33982c3a6838d13 ("net/smc: cleanup function __smc_buf_create()")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
---
net/smc/smc_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index 3b5e5d4bc763..94f21116dac5 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -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;
--
2.13.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] net/smc: fixes for smc buffer handling
2017-11-21 12:23 [PATCH net 0/2] net/smc: fixes for smc buffer handling Ursula Braun
2017-11-21 12:23 ` [PATCH net 1/2] net/smc: use sk_rcvbuf as start for rmb creation Ursula Braun
2017-11-21 12:23 ` [PATCH net 2/2] net/smc: Fix preinitialization of buf_desc in __smc_buf_create() Ursula Braun
@ 2017-11-23 16:34 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-11-23 16:34 UTC (permalink / raw)
To: ubraun; +Cc: netdev, linux-s390, jwi, schwidefsky, heiko.carstens, raspl,
geert
From: Ursula Braun <ubraun@linux.vnet.ibm.com>
Date: Tue, 21 Nov 2017 13:23:52 +0100
> here are 2 cleanup patches for smc buffer handling.
Series applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-23 16:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21 12:23 [PATCH net 0/2] net/smc: fixes for smc buffer handling Ursula Braun
2017-11-21 12:23 ` [PATCH net 1/2] net/smc: use sk_rcvbuf as start for rmb creation Ursula Braun
2017-11-21 12:23 ` [PATCH net 2/2] net/smc: Fix preinitialization of buf_desc in __smc_buf_create() Ursula Braun
2017-11-23 16:34 ` [PATCH net 0/2] net/smc: fixes for smc buffer handling David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).