[Cbe-oss-dev] [PATCH 09/15] ps3: Limit the number of regions per storage device

Geert Uytterhoeven geert at linux-m68k.org
Tue Aug 2 06:30:39 EST 2011


On Mon, Aug 1, 2011 at 22:03, Andre Heider <a.heider at gmail.com> wrote:
> There can be only 8 regions, add a sanity check

Why can there be only 8 regions?

> 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,

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds


More information about the cbe-oss-dev mailing list