Re: [PATCH v2] Bluetooth: btmtksdio: fix uninitialized symbol errors in btmtksdio_rx_packet

From: Marcel Holtmann
Date: Tue Mar 19 2019 - 02:57:13 EST


Hi Sean,

> Fixed all the below warnings. They would probably cause the following
> error handling path would use the uninitialized value and then produce
> unexpected behavior.
>
> drivers/bluetooth/btmtksdio.c:470:2: warning: âold_lenâ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
> print_hex_dump(KERN_ERR, "err sdio rx: ", DUMP_PREFIX_NONE, 4, 1,
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> old_data, old_len, true);
> ~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/bluetooth/btmtksdio.c:376:15: note: âold_lenâ was declared here
> unsigned int old_len;
> ^~~~~~~
> drivers/bluetooth/btmtksdio.c:470:2: warning: âold_dataâ may be used
> uninitialized in this function [-Wmaybe-uninitialized]
> print_hex_dump(KERN_ERR, "err sdio rx: ", DUMP_PREFIX_NONE, 4, 1,
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> old_data, old_len, true);
> ~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/bluetooth/btmtksdio.c:375:17: note: âold_dataâ was declared here
> unsigned char *old_data;
> ^~~~~~~~
>
> v2: Remove old_len and old_data because the error path for sdio_readsb also
> seems wrong. And change the prefix from "mediatek" to "btmtksdio".
>
> Fixes: d74eef2834b5 ("Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices")
> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Reported-by: Marcel Holtmann <marcel@xxxxxxxxxxxx>
> Signed-off-by: Sean Wang <sean.wang@xxxxxxxxxxxx>
> ---
> drivers/bluetooth/btmtksdio.c | 10 ----------
> 1 file changed, 10 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel