Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6608702b authored by Bart Van Assche's avatar Bart Van Assche Committed by Greg Kroah-Hartman
Browse files

scsi: target: cxgbit: Fix cxgbit_fw4_ack()

commit fc5b220b2dcf8b512d9bd46fd17f82257e49bf89 upstream.

Use the pointer 'p' after having tested that pointer instead of before.

Fixes: 5cadafb2 ("target/cxgbit: Fix endianness annotations")
Cc: Varun Prakash <varun@chelsio.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20191023202150.22173-1-bvanassche@acm.org


Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 45e7acdf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1832,7 +1832,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",
@@ -1841,6 +1841,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,