Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fec781a4 authored by David Anderson's avatar David Anderson Committed by android-build-merger
Browse files

Merge "liblp: Handle invalid alignment offsets correctly."

am: 99f610da

Change-Id: Ia2d6150395f4e4705ad8c84d483fe24428ea6cf9
parents a5d1f552 99f610da
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -64,6 +64,12 @@ bool GetBlockDeviceInfo(const std::string& block_device, BlockDeviceInfo* device
        PERROR << __PRETTY_FUNCTION__ << "BLKALIGNOFF failed on " << block_device;
        return false;
    }
    // The kernel can return -1 here when misaligned devices are stacked (i.e.
    // device-mapper).
    if (alignment_offset == -1) {
        alignment_offset = 0;
    }

    int logical_block_size;
    if (ioctl(fd, BLKSSZGET, &logical_block_size) < 0) {
        PERROR << __PRETTY_FUNCTION__ << "BLKSSZGET failed on " << block_device;