All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Daniel Golle <daniel@makrotopia.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	linux-mtd@lists.infradead.org,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Christoph Hellwig <hch@lst.de>, Jan Kara <jack@suse.cz>,
	Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v4] mtd: super: don't rely on mtdblock device minor
Date: Tue, 11 May 2021 07:49:55 +0200	[thread overview]
Message-ID: <20210511054955.GA6542@lst.de> (raw)
In-Reply-To: <YJmx3Ru/5oyq6Y1a@makrotopia.org>

On Mon, May 10, 2021 at 11:21:17PM +0100, Daniel Golle wrote:
> For blktrans devices with partitions (ie. part_bits != 0) the
> assumption that the minor number of the mtdblock device matches
> the mtdnum doesn't hold true.
> Properly resolve mtd device from blktrans layer instead.

Why are you changing the legacy lookup method that is clearly deprecated
in favor of the mdt* syntax?

> +
> +	if (MAJOR(bdev->bd_dev) == MTD_BLOCK_MAJOR) {
> +		if (!bdev->bd_disk)
> +			goto error_mtdblock;

bdev->bd_disk can't be NULL.

>  
> +		blktrans_dev = (struct mtd_blktrans_dev *)(bdev->bd_disk->private_data);

Overly long line due to the not actually required cast.

But more importantly you can't just look at the private data of a random
block device that you just opened.  There is absolutely no guarantee that
it actually points to a specific private data.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2021-05-11 10:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 21:55 [PATCH] mtd: super: don't reply on mtdblock device minor Daniel Golle
2021-04-08  6:15 ` Miquel Raynal
2021-04-08 20:42   ` [PATCH v2] " Daniel Golle
2021-04-12 15:14     ` [PATCH v3] mtd: super: don't rely " Daniel Golle
2021-05-10 10:18       ` Miquel Raynal
2021-05-10 22:20         ` Daniel Golle
2021-05-10 22:21       ` [PATCH v4] " Daniel Golle
2021-05-11  5:49         ` Christoph Hellwig [this message]
2021-05-11  7:57           ` Daniel Golle
2021-05-11 16:42             ` Christoph Hellwig
2021-05-11 20:17               ` Daniel Golle
2021-05-12  6:42                 ` Christoph Hellwig

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=20210511054955.GA6542@lst.de \
    --to=hch@lst.de \
    --cc=daniel@makrotopia.org \
    --cc=dwmw2@infradead.org \
    --cc=hare@suse.de \
    --cc=jack@suse.cz \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.