Skip to contentSkip to conversation

target/cxgbit: Fix endianness annotations

bug report Dan Carpenter 3 participants 3 messages Oct 14, 2019 – Oct 23, 2019 SCSI target

lore
Share & tools
lore
#0 lore raw

Hello Bart Van Assche,

This is a semi-automatic email about new static checker warnings.

The patch 5cadafb236df: "target/cxgbit: Fix endianness annotations" from Jan 13, 2017, leads to the following Smatch complaint:

drivers/target/iscsi/cxgbit/cxgbit_cm.c:1836 cxgbit_fw4_ack()
warn: variable dereferenced before check 'p' (see line 1834)

drivers/target/iscsi/cxgbit/cxgbit_cm.c
1833 struct sk_buff *p = cxgbit_sock_peek_wr(csk);

  1834			const u32 csum = (__force u32)p->csum;
                                                      ^^^^^^^

We moved this dereference earlier

1835

  1836			if (unlikely(!p)) {
                                      ^

so now it's before the NULL check

1837 pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n",
1838 csk, csk->tid, credits,

regards,
dan carpenter

#1 lore raw

Bart?

Quoted 22 lines

This is a semi-automatic email about new static checker warnings.

The patch 5cadafb236df: "target/cxgbit: Fix endianness annotations" from Jan 13, 2017, leads to the following Smatch complaint:

drivers/target/iscsi/cxgbit/cxgbit_cm.c:1836 cxgbit_fw4_ack()
warn: variable dereferenced before check 'p' (see line 1834)

drivers/target/iscsi/cxgbit/cxgbit_cm.c
1833 struct sk_buff *p = cxgbit_sock_peek_wr(csk);

  1834			const u32 csum = (__force u32)p->csum;
                                                      ^^^^^^^

We moved this dereference earlier

1835

  1836			if (unlikely(!p)) {
                                      ^

so now it's before the NULL check

1837 pr_err("csk 0x%p,%u, cr %u,%u+%u, empty.\n",
1838 csk, csk->tid, credits,

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to Dan Carpenter
Quoted 11 lines · Martin K. Petersen

Bart?

Quoted 8 lines

This is a semi-automatic email about new static checker warnings.

The patch 5cadafb236df: "target/cxgbit: Fix endianness annotations" from Jan 13, 2017, leads to the following Smatch complaint:

drivers/target/iscsi/cxgbit/cxgbit_cm.c:1836 cxgbit_fw4_ack()
warn: variable dereferenced before check 'p' (see line 1834)

Hi Martin,

Thanks for the reminder - Dan's email had escaped from my attention. I will submit a patch.

Bart.