1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dev-swap: detect swap signature on devices smaller then 2MB

Smallest supported size for swap device is 40KB, however current
test skipped devices smaller then 4096 sectors (2MB).

Since page is in bytes, convert it to sectors before comparing
with device size (in sectors).
This commit is contained in:
Zdenek Kabelac 2014-03-22 20:36:14 +01:00
parent 93d77455ea
commit 936bfeb8de
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
Fix swap signature detection for devices smaller then 2MB.
Reindent some clvmd.c code.
Use dm_malloc function in clvmd.c.
Resolve memory release order for clvmd shutdown.

View File

@ -59,7 +59,7 @@ int dev_is_swap(struct device *dev, uint64_t *offset_found)
*/
if (page == 0x8000)
continue;
if (size < page)
if (size < (page / 512))
break;
if (!dev_read(dev, page - SIGNATURE_SIZE,
SIGNATURE_SIZE, buf)) {