Re: [PATCH v2 3/3] mwifiex: fix division by zero in fw download path
From: Brian Norris
Date: Wed Oct 27 2021 - 14:23:04 EST
On Wed, Oct 27, 2021 at 1:12 AM Johan Hovold <johan@xxxxxxxxxx> wrote:
> --- a/drivers/net/wireless/marvell/mwifiex/usb.c
> +++ b/drivers/net/wireless/marvell/mwifiex/usb.c
> @@ -505,6 +505,22 @@ static int mwifiex_usb_probe(struct usb_interface *intf,
> }
> }
>
> + switch (card->usb_boot_state) {
> + case USB8XXX_FW_DNLD:
> + /* Reject broken descriptors. */
> + if (!card->rx_cmd_ep || !card->tx_cmd_ep)
> + return -ENODEV;
^^ These two conditions are applicable to USB8XXX_FW_READY too, right?
> + if (card->bulk_out_maxpktsize == 0)
> + return -ENODEV;
> + break;
> + case USB8XXX_FW_READY:
> + /* Assume the driver can handle missing endpoints for now. */
> + break;
> + default:
> + WARN_ON(1);
> + return -ENODEV;
> + }
> +
Anyway, looks pretty good, thanks:
Reviewed-by: Brian Norris <briannorris@xxxxxxxxxxxx>