summaryrefslogtreecommitdiffstats
path: root/DirectVolume.cpp
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2010-03-24 20:18:00 -0700
committerKenny Root <kroot@google.com>2010-03-24 20:18:00 -0700
commitda62e7c00259f6b98696cedb7d031f04951caef0 (patch)
tree2871f9e624e115b4c441c5f05b18c760fc31d538 /DirectVolume.cpp
parenta9f423dd7e313854ce7c103e1bb4661b05efc9a4 (diff)
downloadandroid_system_vold-da62e7c00259f6b98696cedb7d031f04951caef0.tar.gz
android_system_vold-da62e7c00259f6b98696cedb7d031f04951caef0.tar.bz2
android_system_vold-da62e7c00259f6b98696cedb7d031f04951caef0.zip
Revert "Prevent null pointer deref in DirectVolume"
This reverts commit a9f423dd7e313854ce7c103e1bb4661b05efc9a4.
Diffstat (limited to 'DirectVolume.cpp')
-rw-r--r--DirectVolume.cpp45
1 files changed, 12 insertions, 33 deletions
diff --git a/DirectVolume.cpp b/DirectVolume.cpp
index 6af4ccb..fd99f0c 100644
--- a/DirectVolume.cpp
+++ b/DirectVolume.cpp
@@ -124,11 +124,8 @@ int DirectVolume::handleBlockEvent(NetlinkEvent *evt) {
}
void DirectVolume::handleDiskAdded(const char *devpath, NetlinkEvent *evt) {
- int major, minor;
- if (!getMajorMinorNum(evt, &major, &minor)) {
- LOGE("Could not determine major:minor in handleDiskAdded");
- return;
- }
+ mDiskMajor = atoi(evt->findParam("MAJOR"));
+ mDiskMinor = atoi(evt->findParam("MINOR"));
const char *tmp = evt->findParam("NPARTS");
if (tmp) {
@@ -167,11 +164,8 @@ void DirectVolume::handleDiskAdded(const char *devpath, NetlinkEvent *evt) {
}
void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent *evt) {
- int major, minor;
- if (!getMajorMinorNum(evt, &major, &minor)) {
- LOGE("Could not determine major:minor in handlePartitionAdded");
- return;
- }
+ int major = atoi(evt->findParam("MAJOR"));
+ int minor = atoi(evt->findParam("MINOR"));
int part_num;
@@ -213,11 +207,8 @@ void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent *evt)
}
void DirectVolume::handleDiskChanged(const char *devpath, NetlinkEvent *evt) {
- int major, minor;
- if (!getMajorMinorNum(evt, &major, &minor)) {
- LOGE("Could not determine major:minor in handleDiskChanged");
- return;
- }
+ int major = atoi(evt->findParam("MAJOR"));
+ int minor = atoi(evt->findParam("MINOR"));
if ((major != mDiskMajor) || (minor != mDiskMinor)) {
return;
@@ -249,22 +240,14 @@ void DirectVolume::handleDiskChanged(const char *devpath, NetlinkEvent *evt) {
}
void DirectVolume::handlePartitionChanged(const char *devpath, NetlinkEvent *evt) {
- int major, minor;
- if (!getMajorMinorNum(evt, &major, &minor)) {
- LOGE("Could not determine major:minor in handlePartitionChanged");
- return;
- }
-
+ int major = atoi(evt->findParam("MAJOR"));
+ int minor = atoi(evt->findParam("MINOR"));
LOGD("Volume %s %s partition %d:%d changed\n", getLabel(), getMountpoint(), major, minor);
}
void DirectVolume::handleDiskRemoved(const char *devpath, NetlinkEvent *evt) {
- int major, minor;
- if (!getMajorMinorNum(evt, &major, &minor)) {
- LOGE("Could not determine major:minor in handleDiskRemoved");
- return;
- }
-
+ int major = atoi(evt->findParam("MAJOR"));
+ int minor = atoi(evt->findParam("MINOR"));
char msg[255];
LOGD("Volume %s %s disk %d:%d removed\n", getLabel(), getMountpoint(), major, minor);
@@ -276,12 +259,8 @@ void DirectVolume::handleDiskRemoved(const char *devpath, NetlinkEvent *evt) {
}
void DirectVolume::handlePartitionRemoved(const char *devpath, NetlinkEvent *evt) {
- int major, minor;
- if (!getMajorMinorNum(evt, &major, &minor)) {
- LOGE("Could not determine major:minor in handlePartitionRemoved");
- return;
- }
-
+ int major = atoi(evt->findParam("MAJOR"));
+ int minor = atoi(evt->findParam("MINOR"));
char msg[255];
LOGD("Volume %s %s partition %d:%d removed\n", getLabel(), getMountpoint(), major, minor);