Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 1075ac6 in mainline


Ignore:
Timestamp:
2009-08-27T10:56:18Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
5418217
Parents:
6c3d54e
Message:

compare signatures byte-by-byte (avoid dereferencing type-punned pointers, which breaks strict-aliasing rules)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/genarch/src/acpi/acpi.c

    r6c3d54e r1075ac6  
    4646#define RSDP_REVISION_OFFS      15
    4747
     48#define CMP_SIGNATURE(left, right) \
     49        (((left)[0] == (right)[0]) && \
     50        ((left)[1] == (right)[1]) && \
     51        ((left)[2] == (right)[2]) && \
     52        ((left)[3] == (right)[3]))
     53
    4854struct acpi_rsdp *acpi_rsdp = NULL;
    4955struct acpi_rsdt *acpi_rsdt = NULL;
     
    105111                        struct acpi_sdt_header *h = (struct acpi_sdt_header *) (unative_t) acpi_rsdt->entry[i];
    106112               
    107                         map_sdt(h);     
    108                         if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
     113                        map_sdt(h);
     114                        if (CMP_SIGNATURE(h->signature, signature_map[j].signature)) {
    109115                                if (!acpi_sdt_check((uint8_t *) h))
    110116                                        goto next;
     
    127133
    128134                        map_sdt(h);
    129                         if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
     135                        if (CMP_SIGNATURE(h->signature, signature_map[j].signature)) {
    130136                                if (!acpi_sdt_check((uint8_t *) h))
    131137                                        goto next;
Note: See TracChangeset for help on using the changeset viewer.