libavb: fix gcc compilation error.

There is an issue if build libavb for gcc:
external/avb/libavb/avb_slot_verify.c: In functioni 'load_and_verify_vbmeta':
external/avb/libavb/avb_slot_verify.c:171:11: error: 'desc_partition_name' may be used uninitialized in this function
[-Werror=maybe-uninitialized]    found = avb_strv_find_str(requested_partitions,
           ^
external/avb/libavb/avb_slot_verify.c:71:18: note: 'desc_partition_name' was declared here
   const uint8_t* desc_partition_name;
                  ^

The problem in 'out' branch in load_and_verify_vbmeta function.
Execution may get there from line 86 before initializing desc_partition_name:

83  if (!avb_hash_descriptor_validate_and_byteswap(
84          (const AvbHashDescriptor*)descriptor, &hash_desc)) {
85    ret = AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA;
86    goto out;
87  }

But this is not a problem because 'ret' is AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA
and desc_partition_name will not be accessed in this case in 'out' branch
(`result_should_continue' returns false for this ret value):

167 out:
168
169  if (ret == AVB_SLOT_VERIFY_RESULT_OK || result_should_continue(ret)) {
170    /* If this is the requested partition, copy to slot_data. */
171    found = avb_strv_find_str(requested_partitions,
172                              (const char*)desc_partition_name,
173                              hash_desc.partition_name_len);

Change-Id: Ib404e83cfb4b06c8ea458a02afbb2d944da7428d
Signed-off-by: Dzmitry Yatsushkevich <dmitryya@nestlabs.com>
1 file changed
tree: b07d657f1ccc7d59c2010bce059c95926bf00486
  1. boot_control/
  2. libavb/
  3. libavb_ab/
  4. test/
  5. Android.mk
  6. avbtool
  7. LICENSE
  8. README