From: Dan Carpenter <dan.carpenter@oracle.com>
To: sergey.matyukevich.os@quantenna.com
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] qtnfmac: cleanup and unify command error handling
Date: Wed, 10 Oct 2018 13:39:52 +0300 [thread overview]
Message-ID: <20181010103952.GA14986@mwanda> (raw)
Hello Sergey Matyukevich,
The patch c6ed298ffe09: "qtnfmac: cleanup and unify command error
handling" from Oct 5, 2018, leads to the following static checker
warning:
drivers/net/wireless/quantenna/qtnfmac/commands.c:132 qtnf_cmd_send_with_reply()
warn: variable dereferenced before check 'resp' (see line 117)
drivers/net/wireless/quantenna/qtnfmac/commands.c
112 ret = qtnf_trans_send_cmd_with_resp(bus, cmd_skb, &resp_skb);
113 if (ret)
114 goto out;
115
116 resp = (const struct qlink_resp *)resp_skb->data;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117 ret = qtnf_cmd_check_reply_header(resp, cmd_id, mac_id, vif_id,
^^^^
Dereference
118 const_resp_size);
119 if (ret)
120 goto out;
121
122 /* Return length of variable part of response */
123 if (response_skb && var_resp_size)
124 *var_resp_size = le16_to_cpu(resp->mhdr.len) - const_resp_size;
125
126 out:
127 if (response_skb)
128 *response_skb = resp_skb;
129 else
130 consume_skb(resp_skb);
131
132 if (!ret && resp)
^^^^
This new check is not required.
133 return qtnf_cmd_resp_result_decode(le16_to_cpu(resp->result));
134
135 pr_warn("VIF%u.%u: cmd 0x%.4X failed: %d\n",
136 mac_id, vif_id, le16_to_cpu(cmd->cmd_id), ret);
137
138 return ret;
139 }
regards,
dan carpenter
next reply other threads:[~2018-10-10 10:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 10:39 Dan Carpenter [this message]
2018-10-10 14:19 ` [bug report] qtnfmac: cleanup and unify command error handling Sergey Matyukevich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181010103952.GA14986@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-wireless@vger.kernel.org \
--cc=sergey.matyukevich.os@quantenna.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox