You're getting this sort of results because that's not the right way to get the disk size.
If you want to check the size of disk you should issue an ioctl() on disk fd with a request of BLKGETSIZE64 (and argument of pointer to long long).
long long disk_size;
ioctl(<disk_fd>, BLKGETSIZE64, &disk_size);
If you're rather interested in filesystem size (which may be different) or empty space on a filesystem then use statvfs()
call.