[alsa-devel] [bug report] slimbus: ngd: Add qcom SLIMBus NGD driver
Srinivas Kandagatla
srinivas.kandagatla at linaro.org
Tue Aug 7 14:33:19 CEST 2018
Hi Dan,
Thanks for the sharing out this warning msg.
On 07/08/18 13:07, Dan Carpenter wrote:
> Hello Srinivas Kandagatla,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 917809e2280b: "slimbus: ngd: Add qcom SLIMBus NGD driver"
> from Jun 19, 2018, leads to the following Smatch complaint:
>
> drivers/slimbus/qcom-ngd-ctrl.c:867 qcom_slim_ngd_xfer_msg()
> warn: variable dereferenced before check 'txn->msg' (see line 791)
>
> drivers/slimbus/qcom-ngd-ctrl.c
> 790
> 791 if (txn->msg->num_bytes > SLIM_MSGQ_BUF_LEN ||
> ^^^^^^^^^
> Dereference
>
> 792 txn->rl > SLIM_MSGQ_BUF_LEN) {
> 793 dev_err(ctrl->dev, "msg exeeds HW limit\n");
...
> 866
> 867 if (txn->msg && txn->msg->wbuf)
> ^^^^^^^^
> This check is too late.
To be honest this function should not be invoked with txn->msg being
NULL. I can see that slim_val_inf_sanity() enforces this, but we can add
an additional check in slim_do_transfer() for this not to happen in case
slim_do_transfer() is invoked directly.
Check in this ngd driver is totally redundant.
I will try to send a cleanup patch for this once rc1 is out.
thanks,
srini
>
> 868 memcpy(puc, txn->msg->wbuf, txn->msg->num_bytes);
> 869
>
> regards,
> dan carpenter
>
More information about the Alsa-devel
mailing list