mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: "Srivatsa S. Bhat" <srivatsa@csail.mit.edu>, gregkh@linuxfoundation.org
Cc: axboe@kernel.dk, jlayton@poochiereds.net, bfields@fieldses.org,
	linux-kernel@vger.kernel.org
Subject: Re: Change in register_blkdev() behavior
Date: Thu, 1 Feb 2018 23:12:55 -0700	[thread overview]
Message-ID: <ffed4551-fbd0-481f-63f1-aea489395f18@deltatee.com> (raw)
In-Reply-To: <b5609789-cc3e-57b9-1848-57b462fe9b0f@csail.mit.edu>



On 01/02/18 07:17 PM, Srivatsa S. Bhat wrote:
> Thank you for confirming! I'll send a patch to fix that (and the analogous
> case for CHRDEV_MAJOR_DYN_EXT_END).

Great! Thanks!

>>>
>>>                  for (cd = chrdevs[major_to_index(i)]; cd; cd = cd->next)
>>>                          if (cd->major == i)
>>>                                  break;
>>>
>>>                  if (cd == NULL || cd->major != i)
>>>                                       ^^^^^^^^
>>> It seems that this latter condition is unnecessary, as it will never be
>>> true. (We'll reach here only if cd == NULL or cd->major == i).
>>
>> Not quite. chrdevs[] may contain majors that also hit on the hash but don't equal 'i'. So the for loop will iterate through all hashes matching 'i' and if there is one or more and they all don't match 'i', it will fall through the loop and cd will be set to something non-null and not equal to i.
>>
> 
> Hmm, the code doesn't appear to be doing that though? The loop's fall
> through occurs one past the last entry, when cd == NULL. The only
> other way it can exit the loop is if it hits the break statement
> (which implies that cd->major == i). So what am I missing?

Oh, yup, you're right. Looking at it a second (or third) time, it should
be NULL or equal to 'i'.

Thanks,

Logan

  reply	other threads:[~2018-02-02  6:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31  0:56 Srivatsa S. Bhat
2018-01-31  1:26 ` Logan Gunthorpe
2018-02-02  0:23   ` Srivatsa S. Bhat
2018-02-02  1:10     ` Logan Gunthorpe
2018-02-02  2:17       ` Srivatsa S. Bhat
2018-02-02  6:12         ` Logan Gunthorpe [this message]
2018-01-31 14:24 ` Greg KH
2018-02-02  0:25   ` Srivatsa S. Bhat

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=ffed4551-fbd0-481f-63f1-aea489395f18@deltatee.com \
    --to=logang@deltatee.com \
    --cc=axboe@kernel.dk \
    --cc=bfields@fieldses.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jlayton@poochiereds.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srivatsa@csail.mit.edu \
    /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

all inboxes | Powered by JetHome®