Commit 661bc6ec62d462dc7380243f5f45d89442c849d8

Authored by Ye Li
1 parent 7bc5136e52

MLK-20240-7 fastboot: Add NULL return check

Fix coverity issue CID 1898965: Dereference null return value (NULL_RETURNS)
dereference: Dereferencing a pointer that might be NULL dev_desc when calling
write_backup_gpt_partitions

Signed-off-by: Ye Li <ye.li@nxp.com>

Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff

drivers/usb/gadget/f_fastboot.c
... ... @@ -880,6 +880,11 @@
880 880 return -1;
881 881 }
882 882 dev_desc = blk_get_dev("mmc", mmc_no);
  883 + if (dev_desc == NULL) {
  884 + printf("Can't get Block device MMC %d\n",
  885 + mmc_no);
  886 + return -ENODEV;
  887 + }
883 888  
884 889 /* write backup get partition */
885 890 if (write_backup_gpt_partitions(dev_desc, interface.transfer_buffer)) {