[PATCH 09/15] ps3: Limit the number of regions per storage device
Andre Heider
a.heider at gmail.com
Tue Aug 2 06:03:00 EST 2011
There can be only 8 regions, add a sanity check
Signed-off-by: Andre Heider <a.heider at gmail.com>
---
arch/powerpc/include/asm/ps3stor.h | 1 +
arch/powerpc/platforms/ps3/device-init.c | 8 ++++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/ps3stor.h b/arch/powerpc/include/asm/ps3stor.h
index 6fcaf71..d51e53c 100644
--- a/arch/powerpc/include/asm/ps3stor.h
+++ b/arch/powerpc/include/asm/ps3stor.h
@@ -25,6 +25,7 @@
#include <asm/ps3.h>
+#define PS3_STORAGE_MAX_REGIONS (8)
struct ps3_storage_region {
unsigned int id;
diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
index 6c4b583..830d741 100644
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -349,6 +349,14 @@ static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
return -ENODEV;
}
+ if (num_regions > PS3_STORAGE_MAX_REGIONS) {
+ pr_warning("%s:%u: device %u:%u reported %u regions, "
+ "limiting to %u\n", __func__, __LINE__,
+ num_regions, repo->bus_index, repo->dev_index,
+ PS3_STORAGE_MAX_REGIONS);
+ num_regions = PS3_STORAGE_MAX_REGIONS;
+ }
+
pr_debug("%s:%u: (%u:%u:%u): port %llu blk_size %llu num_blocks %llu "
"num_regions %u\n", __func__, __LINE__, repo->bus_index,
repo->dev_index, repo->dev_type, port, blk_size, num_blocks,
--
1.7.5.4
More information about the Linuxppc-dev
mailing list