diff mbox series

target/cxgbit: Fix cxgbit_fw4_ack()

Message ID 20191023202150.22173-1-bvanassche@acm.org (mailing list archive)
State Accepted
Headers show
Series target/cxgbit: Fix cxgbit_fw4_ack() | expand

Commit Message

Bart Van Assche Oct. 23, 2019, 8:21 p.m. UTC
Use the pointer 'p' after having tested that pointer instead of before.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Varun Prakash <varun@chelsio.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: <stable@vger.kernel.org>
Fixes: 5cadafb236df ("target/cxgbit: Fix endianness annotations")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/target/iscsi/cxgbit/cxgbit_cm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Martin K. Petersen Oct. 25, 2019, 12:22 a.m. UTC | #1
> Use the pointer 'p' after having tested that pointer instead of before.

Thanks, Bart! Applied to 5.4/scsi-fixes.
diff mbox series

Patch

diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
index c70caf4ea490..a2b5c796bbc4 100644
--- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c
+++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c
@@ -1831,7 +1831,7 @@  static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb)
 
 	while (credits) {
 		struct sk_buff *p = cxgbit_sock_peek_wr(csk);
-		const u32 csum = (__force u32)p->csum;
+		u32 csum;
 
 		if (unlikely(!p)) {
 			pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n",
@@ -1840,6 +1840,7 @@  static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb)
 			break;
 		}
 
+		csum = (__force u32)p->csum;
 		if (unlikely(credits < csum)) {
 			pr_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n",
 				csk,  csk->tid,