diff options
author | Haoran.Wang <elven.wang@nxp.com> | 2018-09-13 12:39:03 +0800 |
---|---|---|
committer | Haoran.Wang <elven.wang@nxp.com> | 2018-09-13 14:51:00 +0800 |
commit | 0c6af83fedc7db4e7084c2ff0cddfba8090a6356 (patch) | |
tree | e76d540ecdf4f5411c3aec809d9fb0eff2667115 /lib | |
parent | 09e0b888cfa0be91fef27bff76185813fdff1448 (diff) |
MA-12698 Check NULL pointer in secure storage proxy
In some situation, like uuu, the current mmc device
won't return the correct value. Avoid the NULL
pointer in secure storage proxy which may cause
panic.
Change-Id: Ie24afc270fec0b0977dee71b7fc44fe94876e410
Signed-off-by: Haoran.Wang <elven.wang@nxp.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c b/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c index 0c2e87edba..934286cb69 100644 --- a/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c +++ b/lib/trusty/ql-tipc/sysdeps/storage_ops_uboot.c @@ -49,7 +49,15 @@ int rpmb_storage_send(void *rpmb_dev, const void *rel_write_data, ALLOC_CACHE_ALIGN_BUFFER(uint8_t, rpmb_read_data, read_size); int ret = TRUSTY_ERR_NONE; struct mmc *mmc = find_mmc_device(mmc_get_env_dev()); + if (!mmc) { + trusty_error("failed to get mmc device.\n"); + return -1; + } struct blk_desc *desc = mmc_get_blk_desc(mmc); + if (!desc) { + trusty_error("failed to get mmc desc.\n"); + return -1; + } char original_part = desc->hwpart; /* Switch to RPMB partition */ |