Comment 6 for bug 1866772

Revision history for this message
Colin Ian King (colin-king) wrote :

Reproducer occurs when doing odd sized reads that are > 1 byte:

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>

int main(void)
{
        int fd;
        char buffer[3];
        ssize_t n;

        fd = open("/sys/firmware/acpi/tables/data/BERT", O_RDONLY);
        if (fd < 0) {
                fprintf(stderr, "open failed: %d (%s)\n", errno, strerror(errno));
                return -1;
        }
        do {
                n = read(fd, buffer, sizeof(buffer));
        } while (n > 0);

        return 0;
}