summaryrefslogtreecommitdiffstats
path: root/src/hidden.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-03-05 18:59:26 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2011-03-05 18:59:26 +0100
commit1554ea46e8846a4e9e061aa992be36764a6d1117 (patch)
tree9bbc4bd9e827116a77469a8dbf292cb8da782121 /src/hidden.c
parent0718628ebaf1d05961aa804a91a0ecc4cd27a010 (diff)
Fix for HPA and DCO detection (again)
Diffstat (limited to 'src/hidden.c')
-rw-r--r--src/hidden.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/hidden.c b/src/hidden.c
index c167005..919ec1f 100644
--- a/src/hidden.c
+++ b/src/hidden.c
@@ -32,18 +32,26 @@
int is_hpa_or_dco(const disk_t *disk)
{
int res=0;
- if(disk->user_max > 0 && disk->user_max < disk->native_max+1)
+ if(disk->native_max> 0 && disk->user_max < disk->native_max+1)
{
- log_warning("%s: Host Protected Area (HPA) present.\n", disk->device);
res=1;
+ if(disk->native_max < disk->dco)
+ res|=2;
}
- if((disk->native_max > 0 && disk->user_max < disk->native_max+1 && disk->native_max < disk->dco) ||
- (disk->user_max > 0 && disk->user_max < disk->dco+1))
+ else if(disk->dco > 0 && disk->user_max < disk->dco+1)
{
- log_warning("%s: Device Configuration Overlay (DCO) present.\n", disk->device);
- res=1;
+ log_info("user_max=%llu dco=%llu\n",
+ (long long unsigned) disk->user_max,
+ (long long unsigned) disk->dco);
+ res|=2;
}
if(res>0)
+ {
+ if(res&1)
+ log_warning("%s: Host Protected Area (HPA) present.\n", disk->device);
+ if(res&2)
+ log_warning("%s: Device Configuration Overlay (DCO) present.\n", disk->device);
log_flush();
+ }
return res;
}