diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2017-10-26 19:25:46 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2017-12-01 13:22:56 +0100 |
commit | 93945f2c65ff80290fc2af4f5c5d9bb52ff9ffa5 (patch) | |
tree | c81220ba2eb5bd329f868a6719e884bf8be59f1b /lib | |
parent | 753edb131a856267ca06598be0697163dbe58a49 (diff) | |
download | u-boot-93945f2c65ff80290fc2af4f5c5d9bb52ff9ffa5.tar.gz |
efi_loader: efi_disk: check return value of calloc
Calloc may return NULL. We should check the return value.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/efi_loader/efi_disk.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index e61dbc8058..c6f0d732c1 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -196,6 +196,15 @@ efi_fs_from_path(struct efi_device_path *fp) return diskobj->volume; } +/* + * Create a device for a disk + * + * @name not used + * @if_typename interface name for block device + * @desc internal block device + * @dev_index device index for block device + * @offset offset into disk for simple partitions + */ static void efi_disk_add_dev(const char *name, const char *if_typename, struct blk_desc *desc, @@ -210,6 +219,10 @@ static void efi_disk_add_dev(const char *name, return; diskobj = calloc(1, sizeof(*diskobj)); + if (!diskobj) { + printf("ERROR: Out of memory\n"); + return; + } /* Fill in object data */ diskobj->dp = efi_dp_from_part(desc, part); |