Commit 9047a617 authored by Karsten Graul's avatar Karsten Graul Committed by Jakub Kicinski

net/smc: cleanup buffer usage in smc_listen_work()

coccinelle informs about
net/smc/af_smc.c:1770:10-11: WARNING: opportunity for kzfree/kvfree_sensitive

Its not that kzfree() would help here, the memset() is done to prepare
the buffer for another socket receive.
Fix that warning message by reordering the calls, while at it eliminate
the unneeded variable cclc2 and use sizeof(*buf) as above in the same
function. No functional changes.
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent c60a2cef
...@@ -1664,7 +1664,6 @@ static void smc_listen_work(struct work_struct *work) ...@@ -1664,7 +1664,6 @@ static void smc_listen_work(struct work_struct *work)
smc_listen_work); smc_listen_work);
u8 version = smc_ism_v2_capable ? SMC_V2 : SMC_V1; u8 version = smc_ism_v2_capable ? SMC_V2 : SMC_V1;
struct socket *newclcsock = new_smc->clcsock; struct socket *newclcsock = new_smc->clcsock;
struct smc_clc_msg_accept_confirm_v2 *cclc2;
struct smc_clc_msg_accept_confirm *cclc; struct smc_clc_msg_accept_confirm *cclc;
struct smc_clc_msg_proposal_area *buf; struct smc_clc_msg_proposal_area *buf;
struct smc_clc_msg_proposal *pclc; struct smc_clc_msg_proposal *pclc;
...@@ -1740,11 +1739,9 @@ static void smc_listen_work(struct work_struct *work) ...@@ -1740,11 +1739,9 @@ static void smc_listen_work(struct work_struct *work)
mutex_unlock(&smc_server_lgr_pending); mutex_unlock(&smc_server_lgr_pending);
/* receive SMC Confirm CLC message */ /* receive SMC Confirm CLC message */
cclc2 = (struct smc_clc_msg_accept_confirm_v2 *)buf; memset(buf, 0, sizeof(*buf));
cclc = (struct smc_clc_msg_accept_confirm *)cclc2; cclc = (struct smc_clc_msg_accept_confirm *)buf;
memset(buf, 0, sizeof(struct smc_clc_msg_proposal_area)); rc = smc_clc_wait_msg(new_smc, cclc, sizeof(*buf),
rc = smc_clc_wait_msg(new_smc, cclc2,
sizeof(struct smc_clc_msg_proposal_area),
SMC_CLC_CONFIRM, CLC_WAIT_TIME); SMC_CLC_CONFIRM, CLC_WAIT_TIME);
if (rc) { if (rc) {
if (!ini->is_smcd) if (!ini->is_smcd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment