diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig | 4 | ||||
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/acpi/acpi.c | 7 | ||||
-rw-r--r-- | lib/acpi/acpi_table.c | 52 | ||||
-rw-r--r-- | lib/acpi/base.c | 6 | ||||
-rw-r--r-- | lib/acpi/csrt.c | 2 | ||||
-rw-r--r-- | lib/acpi/mcfg.c | 2 | ||||
-rw-r--r-- | lib/acpi/ssdt.c | 2 | ||||
-rw-r--r-- | lib/efi_loader/efi_boottime.c | 3 | ||||
-rw-r--r-- | lib/efi_loader/efi_device_path_to_text.c | 3 | ||||
-rw-r--r-- | lib/mbedtls/pkcs7_parser.c | 4 | ||||
-rw-r--r-- | lib/membuf.c (renamed from lib/membuff.c) | 73 | ||||
-rw-r--r-- | lib/tiny-printf.c | 3 | ||||
-rw-r--r-- | lib/zlib/inflate.c | 21 |
14 files changed, 120 insertions, 64 deletions
diff --git a/lib/Kconfig b/lib/Kconfig index a21b3378fa7..17954461114 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -445,7 +445,9 @@ config CIRCBUF source "lib/dhry/Kconfig" menu "Alternative crypto libraries" -source lib/mbedtls/Kconfig + +source "lib/mbedtls/Kconfig" + endmenu menu "Security support" diff --git a/lib/Makefile b/lib/Makefile index a30ce1595d5..41de2671cc6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -125,7 +125,7 @@ obj-y += hang.o obj-y += linux_compat.o obj-y += linux_string.o obj-$(CONFIG_$(PHASE_)LMB) += lmb.o -obj-y += membuff.o +obj-y += membuf.o obj-$(CONFIG_REGEX) += slre.o obj-y += string.o obj-y += tables_csum.o diff --git a/lib/acpi/acpi.c b/lib/acpi/acpi.c index f4d5c1e25d0..596301a43fe 100644 --- a/lib/acpi/acpi.c +++ b/lib/acpi/acpi.c @@ -6,11 +6,18 @@ */ #include <mapmem.h> +#include <tables_csum.h> #include <acpi/acpi_table.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR; +void acpi_update_checksum(struct acpi_table_header *header) +{ + header->checksum = 0; + header->checksum = table_compute_checksum(header, header->length); +} + struct acpi_table_header *acpi_find_table(const char *sig) { struct acpi_rsdp *rsdp; diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c index c0ed24984af..43b71182133 100644 --- a/lib/acpi/acpi_table.c +++ b/lib/acpi/acpi_table.c @@ -66,6 +66,7 @@ int acpi_create_dmar(struct acpi_dmar *dmar, enum dmar_flags flags) dmar->host_address_width = info.address_width - 1; dmar->flags = flags; + header->checksum = table_compute_checksum(dmar, header->length); return 0; } @@ -195,9 +196,7 @@ int acpi_add_table(struct acpi_ctx *ctx, void *table) (sizeof(u32) * (i + 1)); /* Re-calculate checksum */ - rsdt->header.checksum = 0; - rsdt->header.checksum = table_compute_checksum((u8 *)rsdt, - rsdt->header.length); + acpi_update_checksum(&rsdt->header); } if (ctx->xsdt) { @@ -228,9 +227,7 @@ int acpi_add_table(struct acpi_ctx *ctx, void *table) (sizeof(u64) * (i + 1)); /* Re-calculate checksum */ - xsdt->header.checksum = 0; - xsdt->header.checksum = table_compute_checksum((u8 *)xsdt, - xsdt->header.length); + acpi_update_checksum(&xsdt->header); } return 0; @@ -255,8 +252,8 @@ int acpi_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer *entry) header->creator_revision = 1; fadt->minor_revision = 2; - fadt->x_firmware_ctrl = map_to_sysmem(ctx->facs); - fadt->x_dsdt = map_to_sysmem(ctx->dsdt); + fadt->x_firmware_ctrl = nomap_to_sysmem(ctx->facs); + fadt->x_dsdt = nomap_to_sysmem(ctx->dsdt); if (fadt->x_firmware_ctrl < 0x100000000ULL) fadt->firmware_ctrl = fadt->x_firmware_ctrl; @@ -268,7 +265,7 @@ int acpi_write_fadt(struct acpi_ctx *ctx, const struct acpi_writer *entry) acpi_fill_fadt(fadt); - header->checksum = table_compute_checksum(fadt, header->length); + acpi_update_checksum(header); return acpi_add_fadt(ctx, fadt); } @@ -303,7 +300,7 @@ int acpi_write_madt(struct acpi_ctx *ctx, const struct acpi_writer *entry) if (IS_ENABLED(CONFIG_ACPI_PARKING_PROTOCOL)) acpi_write_park(madt); - header->checksum = table_compute_checksum((void *)madt, header->length); + acpi_update_checksum(header); acpi_add_table(ctx, madt); ctx->current = (void *)madt + madt->header.length; @@ -374,7 +371,7 @@ void acpi_create_dbg2(struct acpi_dbg2_header *dbg2, /* Update structure lengths and checksum */ device->length = current - (uintptr_t)device; header->length = current - (uintptr_t)dbg2; - header->checksum = table_compute_checksum(dbg2, header->length); + acpi_update_checksum(header); } int acpi_write_dbg2_pci_uart(struct acpi_ctx *ctx, struct udevice *dev, @@ -549,7 +546,7 @@ static int acpi_write_spcr(struct acpi_ctx *ctx, const struct acpi_writer *entry spcr->baud_rate = 0; /* Fix checksum */ - header->checksum = table_compute_checksum((void *)spcr, header->length); + acpi_update_checksum(header); acpi_add_table(ctx, spcr); acpi_inc(ctx, spcr->header.length); @@ -615,6 +612,7 @@ int acpi_iort_add_named_component(struct acpi_ctx *ctx, node->length += strlen(device_name) + 1; comp = (struct acpi_iort_named_component *)node->node_data; + memset(comp, '\0', sizeof(struct acpi_iort_named_component)); comp->node_flags = node_flags; comp->memory_properties = memory_properties; @@ -635,6 +633,7 @@ int acpi_iort_add_rc(struct acpi_ctx *ctx, const struct acpi_iort_id_mapping *map) { struct acpi_iort_id_mapping *mapping; + struct acpi_iort_node *output_node; struct acpi_iort_node *node; struct acpi_iort_rc *rc; int offset; @@ -646,12 +645,18 @@ int acpi_iort_add_rc(struct acpi_ctx *ctx, node->type = ACPI_IORT_NODE_PCI_ROOT_COMPLEX; node->revision = 2; + node->mapping_count = num_mappings; + if (num_mappings) + node->mapping_offset = sizeof(struct acpi_iort_node) + + sizeof(struct acpi_iort_rc); node->length = sizeof(struct acpi_iort_node); node->length += sizeof(struct acpi_iort_rc); node->length += sizeof(struct acpi_iort_id_mapping) * num_mappings; rc = (struct acpi_iort_rc *)node->node_data; + memset(rc, '\0', sizeof(struct acpi_iort_rc)); + rc->mem_access_properties = mem_access_properties; rc->ats_attributes = ats_attributes; rc->pci_segment_number = pci_segment_number; @@ -659,6 +664,13 @@ int acpi_iort_add_rc(struct acpi_ctx *ctx, mapping = (struct acpi_iort_id_mapping *)(rc + 1); for (int i = 0; i < num_mappings; i++) { + /* Validate input */ + output_node = (struct acpi_iort_node *)ctx->tab_start + map[i].output_reference; + /* ID mappings can use SMMUs or ITS groups as output references */ + assert(output_node && ((output_node->type == ACPI_IORT_NODE_ITS_GROUP) || + (output_node->type == ACPI_IORT_NODE_SMMU) || + (output_node->type == ACPI_IORT_NODE_SMMU_V3))); + memcpy(mapping, &map[i], sizeof(struct acpi_iort_id_mapping)); mapping++; } @@ -683,6 +695,7 @@ int acpi_iort_add_smmu_v3(struct acpi_ctx *ctx, const struct acpi_iort_id_mapping *map) { struct acpi_iort_node *node; + struct acpi_iort_node *output_node; struct acpi_iort_smmu_v3 *smmu; struct acpi_iort_id_mapping *mapping; int offset; @@ -695,13 +708,16 @@ int acpi_iort_add_smmu_v3(struct acpi_ctx *ctx, node->type = ACPI_IORT_NODE_SMMU_V3; node->revision = 5; node->mapping_count = num_mappings; - node->mapping_offset = sizeof(struct acpi_iort_node) + sizeof(struct acpi_iort_smmu_v3); + if (num_mappings) + node->mapping_offset = sizeof(struct acpi_iort_node) + + sizeof(struct acpi_iort_smmu_v3); node->length = sizeof(struct acpi_iort_node); node->length += sizeof(struct acpi_iort_smmu_v3); node->length += sizeof(struct acpi_iort_id_mapping) * num_mappings; smmu = (struct acpi_iort_smmu_v3 *)node->node_data; + memset(smmu, '\0', sizeof(struct acpi_iort_smmu_v3)); smmu->base_address = base_address; smmu->flags = flags; @@ -716,6 +732,14 @@ int acpi_iort_add_smmu_v3(struct acpi_ctx *ctx, mapping = (struct acpi_iort_id_mapping *)(smmu + 1); for (int i = 0; i < num_mappings; i++) { + /* Validate input */ + output_node = (struct acpi_iort_node *)ctx->tab_start + map[i].output_reference; + /* + * ID mappings of an SMMUv3 node can only have ITS group nodes + * as output references. + */ + assert(output_node && output_node->type == ACPI_IORT_NODE_ITS_GROUP); + memcpy(mapping, &map[i], sizeof(struct acpi_iort_id_mapping)); mapping++; } @@ -759,7 +783,7 @@ static int acpi_write_iort(struct acpi_ctx *ctx, const struct acpi_writer *entry /* (Re)calculate length and checksum */ iort->header.length = ctx->current - (void *)iort; - iort->header.checksum = table_compute_checksum((void *)iort, iort->header.length); + acpi_update_checksum(&iort->header); log_debug("IORT at %p, length %x\n", iort, iort->header.length); /* Drop the table if it is empty */ diff --git a/lib/acpi/base.c b/lib/acpi/base.c index 8b6af2bc43a..5c755b14c16 100644 --- a/lib/acpi/base.c +++ b/lib/acpi/base.c @@ -50,8 +50,7 @@ static void acpi_write_rsdt(struct acpi_rsdt *rsdt) /* Entries are filled in later, we come with an empty set */ /* Fix checksum */ - header->checksum = table_compute_checksum(rsdt, - sizeof(struct acpi_rsdt)); + acpi_update_checksum(header); } static void acpi_write_xsdt(struct acpi_xsdt *xsdt) @@ -66,8 +65,7 @@ static void acpi_write_xsdt(struct acpi_xsdt *xsdt) /* Entries are filled in later, we come with an empty set */ /* Fix checksum */ - header->checksum = table_compute_checksum(xsdt, - sizeof(struct acpi_xsdt)); + acpi_update_checksum(header); } static int acpi_write_base(struct acpi_ctx *ctx, diff --git a/lib/acpi/csrt.c b/lib/acpi/csrt.c index 00927e53406..b863c644c07 100644 --- a/lib/acpi/csrt.c +++ b/lib/acpi/csrt.c @@ -40,7 +40,7 @@ int acpi_write_csrt(struct acpi_ctx *ctx, const struct acpi_writer *entry) /* (Re)calculate length and checksum */ header->length = (ulong)ctx->current - (ulong)csrt; - header->checksum = table_compute_checksum(csrt, header->length); + acpi_update_checksum(header); acpi_add_table(ctx, csrt); diff --git a/lib/acpi/mcfg.c b/lib/acpi/mcfg.c index 8b8a5bfafae..e21fe7ce123 100644 --- a/lib/acpi/mcfg.c +++ b/lib/acpi/mcfg.c @@ -57,7 +57,7 @@ int acpi_write_mcfg(struct acpi_ctx *ctx, const struct acpi_writer *entry) /* (Re)calculate length and checksum */ header->length = (ulong)ctx->current - (ulong)mcfg; - header->checksum = table_compute_checksum(mcfg, header->length); + acpi_update_checksum(header); acpi_add_table(ctx, mcfg); diff --git a/lib/acpi/ssdt.c b/lib/acpi/ssdt.c index df1d739d117..41e2d3c2f6c 100644 --- a/lib/acpi/ssdt.c +++ b/lib/acpi/ssdt.c @@ -35,7 +35,7 @@ int acpi_write_ssdt(struct acpi_ctx *ctx, const struct acpi_writer *entry) /* (Re)calculate length and checksum */ ssdt->length = ctx->current - (void *)ssdt; - ssdt->checksum = table_compute_checksum((void *)ssdt, ssdt->length); + acpi_update_checksum(ssdt); log_debug("SSDT at %p, length %x\n", ssdt, ssdt->length); /* Drop the table if it is empty */ diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index c8d9a6037f7..f220daa048f 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -15,6 +15,7 @@ #include <irq_func.h> #include <log.h> #include <malloc.h> +#include <net-common.h> #include <pe.h> #include <time.h> #include <u-boot/crc.h> @@ -2231,6 +2232,8 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, if (!efi_st_keep_devices) { bootm_disable_interrupts(); + if (IS_ENABLED(CONFIG_DM_ETH)) + eth_halt(); board_quiesce_devices(); dm_remove_devices_active(); } diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index f6889cb7399..452ec1b2e8b 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -181,10 +181,13 @@ static char *dp_msging(char *s, struct efi_device_path *dp) switch (idp->protocol) { case IPPROTO_TCP: s += sprintf(s, "TCP,"); + break; case IPPROTO_UDP: s += sprintf(s, "UDP,"); + break; default: s += sprintf(s, "0x%x,", idp->protocol); + break; } s += sprintf(s, idp->static_ip_address ? "Static" : "DHCP"); s += sprintf(s, ",%pI4", &idp->local_ip_address); diff --git a/lib/mbedtls/pkcs7_parser.c b/lib/mbedtls/pkcs7_parser.c index ecfcc46edfa..bf8ee17b5b8 100644 --- a/lib/mbedtls/pkcs7_parser.c +++ b/lib/mbedtls/pkcs7_parser.c @@ -189,10 +189,6 @@ static int authattrs_parse(struct pkcs7_message *msg, void *aa, size_t aa_len, len)) { if (__test_and_set_bit(sinfo_has_smime_caps, &sinfo->aa_set)) return -EINVAL; - - if (msg->data_type != OID_msIndirectData && - msg->data_type != OID_data) - return -EINVAL; } else if (!MBEDTLS_OID_CMP_RAW(MBEDTLS_OID_MICROSOFT_SPOPUSINFO, inner_p, len)) { if (__test_and_set_bit(sinfo_has_ms_opus_info, &sinfo->aa_set)) diff --git a/lib/membuff.c b/lib/membuf.c index b242a38ff1c..f38ff36cb0b 100644 --- a/lib/membuff.c +++ b/lib/membuf.c @@ -9,17 +9,17 @@ #include <errno.h> #include <log.h> #include <malloc.h> -#include "membuff.h" +#include "membuf.h" -void membuff_purge(struct membuff *mb) +void membuf_purge(struct membuf *mb) { /* set mb->head and mb->tail so the buffers look empty */ mb->head = mb->start; mb->tail = mb->start; } -static int membuff_putrawflex(struct membuff *mb, int maxlen, bool update, - char ***data, int *offsetp) +static int membuf_putrawflex(struct membuf *mb, int maxlen, bool update, + char ***data, int *offsetp) { int len; @@ -72,30 +72,30 @@ static int membuff_putrawflex(struct membuff *mb, int maxlen, bool update, return len; } -int membuff_putraw(struct membuff *mb, int maxlen, bool update, char **data) +int membuf_putraw(struct membuf *mb, int maxlen, bool update, char **data) { char **datap; int offset; int size; - size = membuff_putrawflex(mb, maxlen, update, &datap, &offset); + size = membuf_putrawflex(mb, maxlen, update, &datap, &offset); *data = *datap + offset; return size; } -bool membuff_putbyte(struct membuff *mb, int ch) +bool membuf_putbyte(struct membuf *mb, int ch) { char *data; - if (membuff_putraw(mb, 1, true, &data) != 1) + if (membuf_putraw(mb, 1, true, &data) != 1) return false; *data = ch; return true; } -int membuff_getraw(struct membuff *mb, int maxlen, bool update, char **data) +int membuf_getraw(struct membuf *mb, int maxlen, bool update, char **data) { int len; @@ -146,21 +146,21 @@ int membuff_getraw(struct membuff *mb, int maxlen, bool update, char **data) return len; } -int membuff_getbyte(struct membuff *mb) +int membuf_getbyte(struct membuf *mb) { char *data = 0; - return membuff_getraw(mb, 1, true, &data) != 1 ? -1 : *(uint8_t *)data; + return membuf_getraw(mb, 1, true, &data) != 1 ? -1 : *(uint8_t *)data; } -int membuff_peekbyte(struct membuff *mb) +int membuf_peekbyte(struct membuf *mb) { char *data = 0; - return membuff_getraw(mb, 1, false, &data) != 1 ? -1 : *(uint8_t *)data; + return membuf_getraw(mb, 1, false, &data) != 1 ? -1 : *(uint8_t *)data; } -int membuff_get(struct membuff *mb, char *buff, int maxlen) +int membuf_get(struct membuf *mb, char *buff, int maxlen) { char *data = 0, *buffptr = buff; int len = 1, i; @@ -171,7 +171,7 @@ int membuff_get(struct membuff *mb, char *buff, int maxlen) */ for (i = 0; len && i < 2; i++) { /* get a pointer to the data available */ - len = membuff_getraw(mb, maxlen, true, &data); + len = membuf_getraw(mb, maxlen, true, &data); /* copy it into the buffer */ memcpy(buffptr, data, len); @@ -183,14 +183,14 @@ int membuff_get(struct membuff *mb, char *buff, int maxlen) return buffptr - buff; } -int membuff_put(struct membuff *mb, const char *buff, int length) +int membuf_put(struct membuf *mb, const char *buff, int length) { char *data; int towrite, i, written; for (i = written = 0; i < 2; i++) { /* ask where some data can be written */ - towrite = membuff_putraw(mb, length, true, &data); + towrite = membuf_putraw(mb, length, true, &data); /* and write it, updating the bytes length */ memcpy(data, buff, towrite); @@ -203,14 +203,14 @@ int membuff_put(struct membuff *mb, const char *buff, int length) return written; } -bool membuff_isempty(struct membuff *mb) +bool membuf_isempty(struct membuf *mb) { return mb->head == mb->tail; } -int membuff_avail(struct membuff *mb) +int membuf_avail(struct membuf *mb) { - struct membuff copy; + struct membuf copy; int i, avail; char *data = 0; @@ -219,18 +219,18 @@ int membuff_avail(struct membuff *mb) /* now read everything out of the copied buffer */ for (i = avail = 0; i < 2; i++) - avail += membuff_getraw(©, -1, true, &data); + avail += membuf_getraw(©, -1, true, &data); /* and return how much we read */ return avail; } -int membuff_size(struct membuff *mb) +int membuf_size(struct membuf *mb) { return mb->end - mb->start; } -bool membuff_makecontig(struct membuff *mb) +bool membuf_makecontig(struct membuf *mb) { int topsize, botsize; @@ -281,13 +281,14 @@ bool membuff_makecontig(struct membuff *mb) return true; } -int membuff_free(struct membuff *mb) +int membuf_free(struct membuf *mb) { return mb->end == mb->start ? 0 : - (mb->end - mb->start) - 1 - membuff_avail(mb); + (mb->end - mb->start) - 1 - membuf_avail(mb); } -int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch, bool must_fit) +int membuf_readline(struct membuf *mb, char *str, int maxlen, int minch, + bool must_fit) { int len; /* number of bytes read (!= string length) */ char *s, *end; @@ -322,7 +323,7 @@ int membuff_readline(struct membuff *mb, char *str, int maxlen, int minch, bool return len; } -int membuff_extend_by(struct membuff *mb, int by, int max) +int membuf_extend_by(struct membuf *mb, int by, int max) { int oldhead, oldtail; int size, orig; @@ -358,32 +359,32 @@ int membuff_extend_by(struct membuff *mb, int by, int max) return 0; } -void membuff_init(struct membuff *mb, char *buff, int size) +void membuf_init(struct membuf *mb, char *buff, int size) { mb->start = buff; mb->end = mb->start + size; - membuff_purge(mb); + membuf_purge(mb); } -int membuff_new(struct membuff *mb, int size) +int membuf_new(struct membuf *mb, int size) { mb->start = malloc(size); if (!mb->start) return -ENOMEM; - membuff_init(mb, mb->start, size); + membuf_init(mb, mb->start, size); return 0; } -void membuff_uninit(struct membuff *mb) +void membuf_uninit(struct membuf *mb) { mb->end = NULL; mb->start = NULL; - membuff_purge(mb); + membuf_purge(mb); } -void membuff_dispose(struct membuff *mb) +void membuf_dispose(struct membuf *mb) { - free(&mb->start); - membuff_uninit(mb); + free(mb->start); + membuf_uninit(mb); } diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c index faf55d7f327..2a7a4d286c0 100644 --- a/lib/tiny-printf.c +++ b/lib/tiny-printf.c @@ -283,8 +283,9 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va) break; } islong = true; - /* no break */ + fallthrough; case 'x': + case 'X': if (islong) { num = va_arg(va, unsigned long); div = 1UL << (sizeof(long) * 8 - 4); diff --git a/lib/zlib/inflate.c b/lib/zlib/inflate.c index b4c72cc2c5c..2b7a464f74f 100644 --- a/lib/zlib/inflate.c +++ b/lib/zlib/inflate.c @@ -420,6 +420,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = TIME; + fallthrough; case TIME: NEEDBITS(32); if (state->head != Z_NULL) @@ -427,6 +428,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) if (state->flags & 0x0200) CRC4(state->check, hold); INITBITS(); state->mode = OS; + fallthrough; case OS: NEEDBITS(16); if (state->head != Z_NULL) { @@ -436,6 +438,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) if (state->flags & 0x0200) CRC2(state->check, hold); INITBITS(); state->mode = EXLEN; + fallthrough; case EXLEN: if (state->flags & 0x0400) { NEEDBITS(16); @@ -448,6 +451,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) else if (state->head != Z_NULL) state->head->extra = Z_NULL; state->mode = EXTRA; + fallthrough; case EXTRA: if (state->flags & 0x0400) { copy = state->length; @@ -471,6 +475,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } state->length = 0; state->mode = NAME; + fallthrough; case NAME: if (state->flags & 0x0800) { if (have == 0) goto inf_leave; @@ -492,6 +497,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) state->head->name = Z_NULL; state->length = 0; state->mode = COMMENT; + fallthrough; case COMMENT: if (state->flags & 0x1000) { if (have == 0) goto inf_leave; @@ -512,6 +518,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) else if (state->head != Z_NULL) state->head->comment = Z_NULL; state->mode = HCRC; + fallthrough; case HCRC: if (state->flags & 0x0200) { NEEDBITS(16); @@ -535,6 +542,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) strm->adler = state->check = REVERSE(hold); INITBITS(); state->mode = DICT; + fallthrough; case DICT: if (state->havedict == 0) { RESTORE(); @@ -542,9 +550,11 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } strm->adler = state->check = adler32(0L, Z_NULL, 0); state->mode = TYPE; + fallthrough; case TYPE: schedule(); if (flush == Z_BLOCK) goto inf_leave; + fallthrough; case TYPEDO: if (state->last) { BYTEBITS(); @@ -590,6 +600,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) state->length)); INITBITS(); state->mode = COPY; + fallthrough; case COPY: copy = state->length; if (copy) { @@ -625,6 +636,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) Tracev((stderr, "inflate: table sizes ok\n")); state->have = 0; state->mode = LENLENS; + fallthrough; case LENLENS: while (state->have < state->ncode) { NEEDBITS(3); @@ -646,6 +658,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) Tracev((stderr, "inflate: code lengths ok\n")); state->have = 0; state->mode = CODELENS; + fallthrough; case CODELENS: while (state->have < state->nlen + state->ndist) { for (;;) { @@ -720,6 +733,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } Tracev((stderr, "inflate: codes ok\n")); state->mode = LEN; + fallthrough; case LEN: schedule(); if (have >= 6 && left >= 258) { @@ -764,6 +778,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } state->extra = (unsigned)(this.op) & 15; state->mode = LENEXT; + fallthrough; case LENEXT: if (state->extra) { NEEDBITS(state->extra); @@ -772,6 +787,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } Tracevv((stderr, "inflate: length %u\n", state->length)); state->mode = DIST; + fallthrough; case DIST: for (;;) { this = state->distcode[BITS(state->distbits)]; @@ -797,6 +813,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) state->offset = (unsigned)this.val; state->extra = (unsigned)(this.op) & 15; state->mode = DISTEXT; + fallthrough; case DISTEXT: if (state->extra) { NEEDBITS(state->extra); @@ -817,6 +834,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } Tracevv((stderr, "inflate: distance %u\n", state->offset)); state->mode = MATCH; + fallthrough; case MATCH: if (left == 0) goto inf_leave; copy = out - left; @@ -872,6 +890,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } #ifdef GUNZIP state->mode = LENGTH; + fallthrough; case LENGTH: if (state->wrap && state->flags) { NEEDBITS(32); @@ -885,6 +904,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) } #endif state->mode = DONE; + fallthrough; case DONE: ret = Z_STREAM_END; goto inf_leave; @@ -894,6 +914,7 @@ __rcode int ZEXPORT inflate(z_streamp strm, int flush) case MEM: return Z_MEM_ERROR; case SYNC: + fallthrough; default: return Z_STREAM_ERROR; } |