diff options
author | Bart Van Assche <bvanassche@acm.org> | 2019-10-23 16:21:50 -0400 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-10-24 20:22:00 -0400 |
commit | fc5b220b2dcf8b512d9bd46fd17f82257e49bf89 (patch) | |
tree | 36887e39010db4209641a1cba4765df46b26ec23 | |
parent | 8d8b83f5be2a3bdac3695a94e6cb5e50bd114869 (diff) |
scsi: target: cxgbit: Fix cxgbit_fw4_ack()
Use the pointer 'p' after having tested that pointer instead of before.
Fixes: 5cadafb236df ("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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/target/iscsi/cxgbit/cxgbit_cm.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/target/iscsi/cxgbit/cxgbit_cm.c b/drivers/target/iscsi/cxgbit/cxgbit_cm.c index 22dd4c457d6a..23a90c685dc6 100644 --- a/drivers/target/iscsi/cxgbit/cxgbit_cm.c +++ b/drivers/target/iscsi/cxgbit/cxgbit_cm.c | |||
@@ -1829,7 +1829,7 @@ static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb) | |||
1829 | 1829 | ||
1830 | while (credits) { | 1830 | while (credits) { |
1831 | struct sk_buff *p = cxgbit_sock_peek_wr(csk); | 1831 | struct sk_buff *p = cxgbit_sock_peek_wr(csk); |
1832 | const u32 csum = (__force u32)p->csum; | 1832 | u32 csum; |
1833 | 1833 | ||
1834 | if (unlikely(!p)) { | 1834 | if (unlikely(!p)) { |
1835 | pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n", | 1835 | pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n", |
@@ -1838,6 +1838,7 @@ static void cxgbit_fw4_ack(struct cxgbit_sock *csk, struct sk_buff *skb) | |||
1838 | break; | 1838 | break; |
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | csum = (__force u32)p->csum; | ||
1841 | if (unlikely(credits < csum)) { | 1842 | if (unlikely(credits < csum)) { |
1842 | pr_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n", | 1843 | pr_warn("csk 0x%p,%u, cr %u,%u+%u, < %u.\n", |
1843 | csk, csk->tid, | 1844 | csk, csk->tid, |