Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | From 8996f075e64da0e6ffeda57632ef31f8710defcc Mon Sep 17 00:00:00 2001 |
| 2 | From: He Zhe <zhe.he@windriver.com> |
| 3 | Date: Fri, 15 Mar 2019 16:47:03 +0800 |
| 4 | Subject: [PATCH] utilities: Fix build failure with -Werror=maybe-uninitialized |
| 5 | |
| 6 | Summary: |
| 7 | Initialize magic_number to zero to avoid such failure. |
| 8 | utilities/blob_db/blob_log_format.cc:91:3: error: 'magic_number' may be used |
| 9 | uninitialized in this function [-Werror=maybe-uninitialized] |
| 10 | if (magic_number != kMagicNumber) { |
| 11 | ^~ |
| 12 | |
| 13 | Upstream-Status: Accepted [expected version 5.19] |
| 14 | |
| 15 | Signed-off-by: He Zhe <zhe.he@windriver.com> |
| 16 | --- |
| 17 | utilities/blob_db/blob_log_format.cc | 2 +- |
| 18 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 19 | |
| 20 | diff --git a/utilities/blob_db/blob_log_format.cc b/utilities/blob_db/blob_log_format.cc |
| 21 | index 2bf7028..8726cb8 100644 |
| 22 | --- a/utilities/blob_db/blob_log_format.cc |
| 23 | +++ b/utilities/blob_db/blob_log_format.cc |
| 24 | @@ -82,7 +82,7 @@ Status BlobLogFooter::DecodeFrom(Slice src) { |
| 25 | uint32_t src_crc = 0; |
| 26 | src_crc = crc32c::Value(src.data(), BlobLogFooter::kSize - sizeof(uint32_t)); |
| 27 | src_crc = crc32c::Mask(src_crc); |
| 28 | - uint32_t magic_number; |
| 29 | + uint32_t magic_number = 0; |
| 30 | if (!GetFixed32(&src, &magic_number) || !GetFixed64(&src, &blob_count) || |
| 31 | !GetFixed64(&src, &expiration_range.first) || |
| 32 | !GetFixed64(&src, &expiration_range.second) || !GetFixed32(&src, &crc)) { |
| 33 | -- |
| 34 | 2.7.4 |
| 35 | |