linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avri Altman <Avri.Altman@wdc.com>
To: Bradley Bolen <bradleybolen@gmail.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: "ulf.hansson@linaro.org" <ulf.hansson@linaro.org>,
	"kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"wsa+renesas@sang-engineering.com"
	<wsa+renesas@sang-engineering.com>,
	"yinbo.zhu@nxp.com" <yinbo.zhu@nxp.com>,
	"hongjiefang@asrmicro.com" <hongjiefang@asrmicro.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] mmc: core: Fix size overflow for mmc partitions
Date: Thu, 7 Nov 2019 08:30:22 +0000	[thread overview]
Message-ID: <MN2PR04MB69915AFED1B6AFD1B30EFBCDFC780@MN2PR04MB6991.namprd04.prod.outlook.com> (raw)
In-Reply-To: <1573097159-3914-1-git-send-email-bradleybolen@gmail.com>

> 
> With large eMMC cards, it is possible to create general purpose partitions that
> are bigger than 4GB.  The size member of the mmc_part struct is only an
> unsigned int which overflows for gp partitions larger than 4GB.  Change this to a
> u64 to handle the overflow.
> 
> Signed-off-by: Bradley Bolen <bradleybolen@gmail.com>
Looks fine.
Avri

> ---
>  drivers/mmc/core/mmc.c   | 6 +++---
>  include/linux/mmc/card.h | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index
> c880489..fc02124 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -297,7 +297,7 @@ static void mmc_manage_enhanced_area(struct
> mmc_card *card, u8 *ext_csd)
>         }
>  }
> 
> -static void mmc_part_add(struct mmc_card *card, unsigned int size,
> +static void mmc_part_add(struct mmc_card *card, u64 size,
>                          unsigned int part_cfg, char *name, int idx, bool ro,
>                          int area_type)
>  {
> @@ -313,7 +313,7 @@ static void mmc_manage_gp_partitions(struct
> mmc_card *card, u8 *ext_csd)  {
>         int idx;
>         u8 hc_erase_grp_sz, hc_wp_grp_sz;
> -       unsigned int part_size;
> +       u64 part_size;
> 
>         /*
>          * General purpose partition feature support -- @@ -362,7 +362,7 @@
> static void mmc_manage_gp_partitions(struct mmc_card *card, u8 *ext_csd)
> static int mmc_decode_ext_csd(struct mmc_card *card, u8 *ext_csd)  {
>         int err = 0, idx;
> -       unsigned int part_size;
> +       u64 part_size;
>         struct device_node *np;
>         bool broken_hpi = false;
> 
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index
> 9b6336a..b59d35b 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -226,7 +226,7 @@ struct mmc_queue_req;
>   * MMC Physical partitions
>   */
>  struct mmc_part {
> -       unsigned int    size;   /* partition size (in bytes) */
> +       u64             size;   /* partition size (in bytes) */
>         unsigned int    part_cfg;       /* partition type */
>         char    name[MAX_MMC_PART_NAME_LEN];
>         bool    force_ro;       /* to make boot parts RO by default */
> --
> 2.7.4

  reply	other threads:[~2019-11-07  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07  3:25 [PATCH v2] mmc: core: Fix size overflow for mmc partitions Bradley Bolen
2019-11-07  8:30 ` Avri Altman [this message]
2019-11-14 11:12 ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR04MB69915AFED1B6AFD1B30EFBCDFC780@MN2PR04MB6991.namprd04.prod.outlook.com \
    --to=avri.altman@wdc.com \
    --cc=bradleybolen@gmail.com \
    --cc=hongjiefang@asrmicro.com \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=ulf.hansson@linaro.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=yinbo.zhu@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).