소스 검색

fix(ahci): copy minimum of cnt and sector size in read()

greatbridf 1 년 전
부모
커밋
c7a6dee5eb
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/kernel/hw/ahci.cc

+ 1 - 1
src/kernel/hw/ahci.cc

@@ -405,7 +405,7 @@ public:
             if (offset)
                 to_copy = 512 - offset;
             else
-                to_copy = std::max(cnt, 512U);
+                to_copy = std::min(cnt, 512U);
             memcpy(buf, b + offset, to_copy);
             offset = 0;
             buf += to_copy;