public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Ben Hutchings <bhutchings@solarflare.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: linux-net-drivers@solarflare.com, linux-mtd@lists.infradead.org
Subject: Re: [PATCHv2 7/7] mtd: Raise limit on block device minor numbers
Date: Thu, 14 Jan 2010 19:19:29 +0000	[thread overview]
Message-ID: <1263496769.17815.77.camel@localhost> (raw)
In-Reply-To: <1263337846.3011.28.camel@achroite.uk.solarflarecom.com>

On Tue, 2010-01-12 at 23:10 +0000, Ben Hutchings wrote:
> add_mtd_blktrans_dev() imposes a maximum of 257 devices per block
> translator.  This was presumably meant to prevent overflow back in the
> days of 8-bit minor numbers.  Since we now have 20-bit minor numbers
> and can have more than 32 MTDs, change the maximum to MINORMASK.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
>  drivers/mtd/mtd_blkdevs.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
> index 85a52b3..5e88b49 100644
> --- a/drivers/mtd/mtd_blkdevs.c
> +++ b/drivers/mtd/mtd_blkdevs.c
> @@ -242,7 +242,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
>  	if (new->devnum == -1)
>  		new->devnum = last_devnum+1;
>  
> -	if ((new->devnum << tr->part_bits) > 256) {
> +	if ((new->devnum << tr->part_bits) > MINORMASK) {

Actually this still has a boundary error.  I think the correct condition
is:

	new->devnum > (MINORMASK >> tr->part_bits)

Ben.

>  		return -EBUSY;
>  	}
>  
> -- 
> 1.5.5
> 

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

      reply	other threads:[~2010-01-14 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-12 23:10 [PATCHv2 7/7] mtd: Raise limit on block device minor numbers Ben Hutchings
2010-01-14 19:19 ` Ben Hutchings [this message]

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=1263496769.17815.77.camel@localhost \
    --to=bhutchings@solarflare.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-net-drivers@solarflare.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