vold2: Don't allow containers < 1mb, and clean up some logging
Signed-off-by: San Mehat <san@google.com>
This commit is contained in:
parent
b3b4318ab8
commit
d31e380bd9
3 changed files with 7 additions and 3 deletions
|
@ -71,7 +71,6 @@ int Devmapper::lookupActive(const char *name, char *ubuffer, size_t len) {
|
|||
|
||||
unsigned minor = (io->dev & 0xff) | ((io->dev >> 12) & 0xfff00);
|
||||
free(buffer);
|
||||
LOGD("Newly created devmapper instance minor = %d\n", minor);
|
||||
snprintf(ubuffer, len, "/dev/block/dm-%u", minor);
|
||||
return 0;
|
||||
}
|
||||
|
@ -128,7 +127,6 @@ int Devmapper::create(const char *name, const char *loopFile, const char *key,
|
|||
}
|
||||
|
||||
unsigned minor = (io->dev & 0xff) | ((io->dev >> 12) & 0xfff00);
|
||||
LOGD("Newly created devmapper instance minor = %d\n", minor);
|
||||
snprintf(ubuffer, len, "/dev/block/dm-%u", minor);
|
||||
|
||||
// Load the table
|
||||
|
|
2
Loop.cpp
2
Loop.cpp
|
@ -184,7 +184,7 @@ int Loop::destroyByFile(const char *loopFile) {
|
|||
int Loop::createImageFile(const char *file, unsigned int numSectors) {
|
||||
int fd;
|
||||
|
||||
LOGD("Creating ASEC image file %s (%u sectors)", file, numSectors);
|
||||
LOGD("Creating image file %s (%u sectors)", file, numSectors);
|
||||
|
||||
if ((fd = creat(file, 0600)) < 0) {
|
||||
LOGE("Error creating imagefile (%s)", strerror(errno));
|
||||
|
|
|
@ -171,6 +171,12 @@ int VolumeManager::getAsecMountPath(const char *id, char *buffer, int maxlen) {
|
|||
int VolumeManager::createAsec(const char *id, unsigned int numSectors,
|
||||
const char *fstype, const char *key, int ownerUid) {
|
||||
|
||||
if (numSectors < ((1024*1024)/512)) {
|
||||
LOGE("Invalid container size specified (%d sectors)", numSectors);
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
mkdir("/sdcard/android_secure", 0777);
|
||||
|
||||
if (lookupVolume(id)) {
|
||||
|
|
Loading…
Reference in a new issue