usbdev: usbmsc_scsi: Add NULL pointer check. From Juha Niskanen
This commit is contained in:
parent
99f4e31b69
commit
26b9b5a252
|
@ -1457,7 +1457,7 @@ static int inline usbmsc_setupcmd(FAR struct usbmsc_dev_s *priv,
|
||||||
{
|
{
|
||||||
FAR struct usbmsc_lun_s *lun = NULL;
|
FAR struct usbmsc_lun_s *lun = NULL;
|
||||||
uint32_t datlen;
|
uint32_t datlen;
|
||||||
uint8_t dir = flags & USBMSC_FLAGS_DIRMASK;
|
uint8_t dir;
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
|
|
||||||
/* Verify the LUN and set up the current LUN reference in the
|
/* Verify the LUN and set up the current LUN reference in the
|
||||||
|
@ -1528,7 +1528,7 @@ static int inline usbmsc_setupcmd(FAR struct usbmsc_dev_s *priv,
|
||||||
{
|
{
|
||||||
priv->u.alloclen = priv->cbwlen;
|
priv->u.alloclen = priv->cbwlen;
|
||||||
}
|
}
|
||||||
else
|
else if (lun)
|
||||||
{
|
{
|
||||||
priv->u.xfrlen = priv->cbwlen / lun->sectorsize;
|
priv->u.xfrlen = priv->cbwlen / lun->sectorsize;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue