usbdev: usbmsc_scsi: Add NULL pointer check. From Juha Niskanen

This commit is contained in:
Gregory Nutt 2015-03-12 07:55:53 -06:00
parent 99f4e31b69
commit 26b9b5a252
1 changed files with 2 additions and 2 deletions

View File

@ -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;
} }